Skip to content

Commit

Permalink
Remove themes and styles. Display version in Config caption
Browse files Browse the repository at this point in the history
  • Loading branch information
BazzaCuda committed Jun 19, 2023
1 parent 89580ab commit 3edf490
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CustomMenu.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ program CustomMenu;
{$M-} // enables the published keyword
uses
Vcl.Forms,
Vcl.Styles,
Vcl.Themes,
// Vcl.Styles,
// Vcl.Themes,
FormCustomMenu in 'FormCustomMenu.pas' {CustomMenu},
Winapi.Hooks in 'Winapi.Hooks.pas',
CustomMenuCommon in 'CustomMenuCommon.pas',
Expand Down
5 changes: 2 additions & 3 deletions CustomMenu.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>CustomMenu</SanitizedProjectName>
<Custom_Styles>&quot;Charcoal Dark Slate|VCLSTYLE|$(BDSCOMMONDIR)\Styles\CharcoalDarkSlate.vsf&quot;</Custom_Styles>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;RESTComponents;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;GR32_D;vclFireDAC;IndySystem;RARComponent_d2009;bindcompvclsmp;tethering;svnui;bindcompvclwinx;dsnapcon;FireDACADSDriver;VirtualTreesR;FireDACMSAccDriver;fmxFireDAC;vclimg;FireDAC;vcltouch;vcldb;bindcompfmx;svn;FireDACSqliteDriver;FireDACPgDriver;Spring.Data;inetdb;soaprtl;DbxCommonDriver;fmx;FireDACIBDriver;fmxdae;xmlrtl;soapmidas;vcledge;fmxobj;vclwinx;GR32_R;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;VLCActiveX;vclx;bindcomp;appanalytics;dsnap;FireDACCommon;IndyIPClient;bindcompvcl;RESTBackendComponents;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;CloudService;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;WMP;FireDACCommonODBC;FireDACCommonDriver;inet;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
Expand Down Expand Up @@ -141,6 +140,8 @@
<PostBuildEvent><![CDATA[copy $(OUTPUTPATH) $(PROJECTDIR)\SampleMenu\
:: copy $(OUTPUTPATH) F:\
$(PostBuildEvent)]]></PostBuildEvent>
<VerInfo_Release>1</VerInfo_Release>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.1.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.1.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
Expand All @@ -153,12 +154,10 @@ $(PostBuildEvent)]]></PostBuildEvent>
<DCCReference Include="CustomMenuCommon.pas"/>
<DCCReference Include="FormConfig.pas">
<Form>ConfigForm</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="..\DebugWindow\_debugWindow.pas"/>
<DCCReference Include="FormIconExplorer.pas">
<Form>IconExplorerForm</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="winShell.pas"/>
<DCCReference Include="runElevatedSupport.pas"/>
Expand Down
Binary file modified CustomMenu.res
Binary file not shown.
43 changes: 43 additions & 0 deletions CustomMenuCommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ TItemData = record

const
CM_APP_NAME = 'Custom Menu';
CM_APP_VERSION = 'v1.0.1';
CM_BACKGROUND_COLOR = $2B2B2B;
CM_HIGHLIGHT_COLOR = $484848;
CM_ITEM_HEIGHT = 22;
Expand Down Expand Up @@ -76,6 +77,7 @@ function expandPathRelToBaseDir(const filePath: string; baseDir: string): string
function findCustomMenu: boolean;
function getExePath: string;
function getFileNameWithoutExt(filename: string): string;
function getFileVersion(const aFilePath: string = ''; const fmt: string = '%d.%d.%d.%d'): string;
function getINIFileName: string;
function getParamXY: TPoint;
function iconFileFromIconEntry(iconEntry: string): string;
Expand Down Expand Up @@ -269,6 +271,47 @@ function getFileNameWithoutExt(filename: string): string;
result := copy(extractFileName(filename), 1, length(extractFileName(filename)) - length(vExt));
end;

function getFileVersion(const aFilePath: string = ''; const fmt: string = '%d.%d.%d.%d'): string;
var
vFilePath: string;
iBufferSize: DWORD;
iDummy: DWORD;
pBuffer: Pointer;
pFileInfo: Pointer;
iVer: array[1..4] of Word;
begin
// set default value
Result := '';
// get filename of exe/dll if no filename is specified
vFilePath := aFilePath;
case vFilePath = '' of TRUE: begin
// prepare buffer for path and terminating #0
SetLength(vFilePath, MAX_PATH + 1);
SetLength(vFilePath, GetModuleFileName(hInstance, PChar(vFilePath), MAX_PATH + 1));
end;end;

// get size of version info (0 if no version info exists)
iBufferSize := GetFileVersionInfoSize(PChar(vFilePath), iDummy);

case iBufferSize > 0 of TRUE: begin
GetMem(pBuffer, iBufferSize);
try
// get fixed file info (language independent)
GetFileVersionInfo(PChar(vFilePath), 0, iBufferSize, pBuffer);
VerQueryValue(pBuffer, '\', pFileInfo, iDummy);
// read version blocks
iVer[1] := HiWord(PVSFixedFileInfo(pFileInfo)^.dwFileVersionMS);
iVer[2] := LoWord(PVSFixedFileInfo(pFileInfo)^.dwFileVersionMS);
iVer[3] := HiWord(PVSFixedFileInfo(pFileInfo)^.dwFileVersionLS);
iVer[4] := LoWord(PVSFixedFileInfo(pFileInfo)^.dwFileVersionLS);
finally
FreeMem(pBuffer);
end;
// format result string
Result := Format(Fmt, [iVer[1], iVer[2], iVer[3], iVer[4]]);
end;end;
end;

function getINIFileName: string;
begin
result := getExePath + CM_INI_FILE_NAME; {EXIT;} // default
Expand Down
2 changes: 1 addition & 1 deletion FormConfig.pas
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ function shutConfigForm: boolean; // force close from the EXIT tray icon menu it
//========== FORM FUNCTIONS ==========
function TConfigForm.getCleanCaption: string;
begin
result := getINIFileName + ' - ' + CM_APP_NAME;
result := getINIFileName + ' - ' + CM_APP_NAME + ' ' + getFileVersion('', 'v%d.%d.%d');
case isRunningAsAdmin of TRUE: result := result + ' [Admin]'; end;
end;

Expand Down

0 comments on commit 3edf490

Please sign in to comment.