#1486
|
|||
|
|||
Quote:
function TranslateMessage(const lpMsg: TMsg): BOOL; external '[email protected] stdcall'; function DispatchMessage(const lpMsg: TMsg): Longint; external '[email protected] stdcall'; procedure AppProcessMessages; var Msg: TMsg; begin while PeekMessage(Msg, 0, 0, 0, 1) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; end; |
The Following User Says Thank You to DiCaPrIo For This Useful Post: | ||
Carldric Clement (12-08-2021) |
Sponsored Links |
#1487
|
||||
|
||||
Quote:
![]()
__________________
EDM Producer. |
#1488
|
||||
|
||||
Code:
type TMsg = record hWnd: HWND; message: LongWord; wParam: Longint; lParam: Longint; Time: LongWord; pt: TPoint; end; |
The Following 2 Users Say Thank You to Cesar82 For This Useful Post: | ||
Carldric Clement (12-08-2021), DiCaPrIo (12-08-2021) |
#1489
|
|||
|
|||
Is there a way to make a listener (code, etc) that listens to get file size in an inno setup? My goal is to show progress in nanozip. It will listen to the nanozip output file with a time interval and get to the rate of total file size to the current size.
|
#1490
|
||||
|
||||
Is there a way to detect the amount of CPU threads / cores there are and do something accordingly?
Eg. if CPU_THREADS = 6 then begin do_stuff end else begin do_other_stuff end; Asking because some multithreading tools crash when dealing with 6 or 12 threads. |
#1491
|
|||
|
|||
Quote:
Code:
function GetSysCores(): Integer; var WbemLocator, WbemServices, WbemObjectSet, WbemObject: Variant; begin; WbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); WbemServices := WbemLocator.ConnectServer('localhost', 'root\CIMV2'); WbemObjectSet := WbemServices.ExecQuery('Select NumberOfCores from Win32_Processor'); WbemObject := WbemObjectSet.ItemIndex(0); Result := WbemObject.Properties_.Item('NumberOfCores').Value; WbemLocator:=Unassigned; WbemServices:=Unassigned; WbemObjectSet:=Unassigned; WbemObject:=Unassigned; end; function GetSysThreads(): Integer; var WbemLocator, WbemServices, WbemObjectSet, WbemObject: Variant; begin; WbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); WbemServices := WbemLocator.ConnectServer('localhost', 'root\CIMV2'); WbemObjectSet := WbemServices.ExecQuery('Select NumberOfLogicalProcessors from Win32_Processor'); WbemObject := WbemObjectSet.ItemIndex(0); Result := WbemObject.Properties_.Item('NumberOfLogicalProcessors').Value; WbemLocator:=Unassigned; WbemServices:=Unassigned; WbemObjectSet:=Unassigned; WbemObject:=Unassigned; end; |
The Following User Says Thank You to DiCaPrIo For This Useful Post: | ||
Masquerade (18-08-2021) |
#1492
|
||||
|
||||
DiCaPrIo
So I would put if GetSysCores = 6 in the if loop after calling the function? |
#1493
|
|||
|
|||
Quote:
Code:
procedure InitializeWizard(); var Cores,Threads:Integer; begin Cores:=GetSysCores; Threads:=GetSysThreads; if Cores = 6 then begin //yourcode end; if Threads = 6 then begin //yourcode end; end; |
The Following User Says Thank You to DiCaPrIo For This Useful Post: | ||
Masquerade (18-08-2021) |
#1494
|
||||
|
||||
Quote:
if GetSysCores = 6 then begin end; The function can also be simplified using variables of type variant so you can get any supported value just by changing the string you want to search for. Code:
function GetSysInfo(const WMIClass, WMIProperty: String): Variant; var WbemLocator, WbemServices, WbemObjectSet, WbemObject: Variant; begin; WbemLocator := CreateOleObject('WbemScripting.SWbemLocator'); WbemServices := WbemLocator.ConnectServer('localhost', 'root\CIMV2'); WbemObjectSet := WbemServices.ExecQuery('Select ' + WMIProperty + ' from ' + WMIClass); if (not VarIsNull(WbemObjectSet)) and (WbemObjectSet.Count > 0) then begin WbemObject := WbemObjectSet.ItemIndex(0); if not VarIsNull(WbemObject) then Result := WbemObject.Properties_.Item(WMIProperty).Value; end; end; procedure GetFreeMemory(var Free, Total: Extended); begin Total := GetSysInfo('Win32_OperatingSystem', 'TotalVisibleMemorySize'); Free := GetSysInfo('Win32_OperatingSystem ', 'FreePhysicalMemory'); end; function CPUCores: Integer; begin Result := GetSysInfo('Win32_Processor', 'NumberOfCores'); end; function CPUThreads: Integer; begin Result := GetSysInfo('Win32_Processor', 'NumberOfLogicalProcessors'); end; You can also use the API if you prefer to get Threads. Code:
type TSystemInfo = record wProcessorArchitecture: Word; wReserved: Word; dwPageSize: DWORD; lpMinimumApplicationAddress: Integer; lpMaximumApplicationAddress: Integer; dwActiveProcessorMask: DWORD; dwNumberOfProcessors: DWORD; dwProcessorType: DWORD; dwAllocationGranularity: DWORD; wProcessorLevel: Integer; wProcessorRevision: Word; end; procedure GetSystemInfo(var lpSystemInfo: TSystemInfo); external '[email protected] stdcall delayload'; function GetCPUThreads: Integer; var SysInfo: TSystemInfo; begin GetSystemInfo(SysInfo); Result := SysInfo.dwNumberOfProcessors; end; |
The Following 3 Users Say Thank You to Cesar82 For This Useful Post: | ||
#1495
|
||||
|
||||
Has anyone had an installer made using inno setup just soft-lock consistently? Trying to unpack an archive but it consistently gets stuck on this one file, refusing to progress any further, the funny thing is though, no error codes are displayed, the applications "elapsed time" function continues to run, with CPU & Disk utilisation dropping to 0%, I'm honestly stumped on this one.
|
#1496
|
||||
|
||||
L33THAK0R
This appears an issue with the decompressor you are using and not inno setup itself. |
#1497
|
||||
|
||||
Ah grim, well that narrows it down to 2 issues then. Fingers crossed I can get it working! I have a feeling it might be due to the assets I ripped, was a bit messy with ripping shit.
|
#1498
|
||||
|
||||
Just as a preface, I originally posted this in the "ASIS" thread, but I reckon it might be more applicable here.
So I have a handful of repacks which have selective installs for a collection of titles, with each having its own shortcut to be placed on the users Desktop, should they select this as an option. Currently however, regardless of the end-users selection a shortcut for each entry made for the application is placed on the desktop, even if the target file is not present. It's not a critical issue but it is a slight annoyance. My proposed solution, as detailed below, was to use a function named "RemoveShortcut", which is used for the uninstaller generated for a given install, as can be seen here: Code:
[UninstallDelete] Type: filesandordirs; Name: {app} #sub RemoveShortcut #emit "Type: Files; Name: ""{userdesktop}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) + ".lnk"";" #emit "Type: Files; Name: ""{userprograms}\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Settings", "ShortcutName", "")) + "\" + Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) + ".lnk"";" #endsub #for {i = 1; Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) != ""; i++} RemoveShortcut __________________________________________________ __________ ORIGINAL QUESTION: Hi all, Got a small question regarding whether my proposed solution could work at all (I'm terribly new to pascal/delphi). I've got a fair few packs that feature selective, multiple-title offerings to the end-user, each with their own, separate executable to launch from (since some are emulated and require a small script to launch the ROM), as well as their own entry under the shortcut section of the "Settings.ini" file used in ASIS (baked into a executable thats just a batch script wrapped in an exe). My issue is that regardless of the component selection, upon extraction of all selected archives, all desktop shortcuts defined within the "settings.ini" are generated (should the option be selected). My current thought process is using the "RemoveShortcut" function, in the Post-install section of the script to delete the shortcut, if a given .txt file is missing (which would be packed with a given selective offering), like so: Code:
#if ("{app}\_CommonRedist\APPS\APP_1.txt" == "0") && ("{userdesktop}\APP_1.lnk" == "1") #for {i = 1; Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) != ""} RemoveShortcut #endif #if ("{app}\_CommonRedist\APPS\APP_2.txt" == "0") && ("{userdesktop}\APP_2.lnk" == "1") #for {i = 2; Trim(ReadIni(SourcePath + "\Settings.ini", "Executable" + Str(i), "ShortcutName", "")) != ""} RemoveShortcut #endif |
#1499
|
||||
|
||||
I would like to know if anyone has a solution to my problem. I would like to display the thumbnail in the taskbar and at the same time include a checkbox to keep the installer window on top (over other windows) if the checkbox is checked. If I use the code from the page below to display the installer thumbnail on the taskbar the property "WizardForm.FormStyle" doesn't work.
Part of the code was obtained from: inno-setup-window-preview-in-taskbar If anyone can help me, I appreciate it. Below is a code to better understand my question. Code:
[Setup] AppName=My App AppVersion=1.0 DefaultDirName={{#VER > 0x06000000 ? "common" : ""}pf}\My App DisableWelcomePage=no OutputBaseFilename=My_App OutputDir=. [ code] const GW_OWNER = 4; GWL_HWNDPARENT = (-8); function GetWindowLong(Wnd: HWND; nIndex: Integer): Longint; external '[email protected] stdcall delayload'; function SetWindowLong(Wnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external '[email protected] stdcall delayload'; function GetWindow(hWnd: HWND; uCmd: UINT): HWND; external '[email protected] stdcall delayload'; var OnTopCheckBox: TNewCheckBox; ////OldParent: Longint; procedure OnTopCheckBox_OnClick(Sender: TObject); begin if OnTopCheckBox.Checked then begin ////SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, OldParent); WizardForm.FormStyle := fsStayOnTop; end else begin WizardForm.FormStyle := fsNormal; ////SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, GetWindowLong(GetWindow(WizardForm.Handle, GW_OWNER), GWL_HWNDPARENT)); end; end; procedure InitializeWizard(); begin ////OldParent := GetWindowLong(WizardForm.Handle, GWL_HWNDPARENT); OnTopCheckBox := TNewCheckBox.Create(WizardForm); with OnTopCheckBox do begin Parent := WizardForm; Caption := 'Keep On Top'; SetBounds(ScaleX(10), WizardForm.NextButton.Top + ScaleY(2), ScaleX(100), ScaleX(15)); OnClick := @OnTopCheckBox_OnClick; end; { work if disable this line } SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, GetWindowLong(GetWindow(WizardForm.Handle, GW_OWNER), GWL_HWNDPARENT)); end; |
#1500
|
|||
|
|||
Hi all.
Could you please help me with the following: I have an installer for a mod, but if a person uninstalls a mod, the whole game is uninstalled as well. How can I make it so that only the mod files are deleted? I was thinking of keeping an install log and taking files from it to delete, but damn, that doesn't work right. (It doesn't delete files from the list and it doesn't log small files) I'll attach a sample code) Thank you in advance. Code:
Function InitializeUninstall(): Boolean; begin ULog := FileExists(ExpandConstant('{app}\INSTALL.LOG')); // you need to get the log now, it might not exist later if ULog then // if there is a log file, create a sheet where we load the list of files begin unins_list := TStringList.Create; unins_list.LoadFromFile(ExpandConstant('{app}\INSTALL.LOG')); end; Result := True; end; Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); var i : Integer; begin If CurUninstallStep = usPostUninstall then if ULog then begin for i := 0 to unins_list.Count-1 do DeleteFile(unins_list:[i]); // delete files from the list - It doesn't work unins_list.Free; end; end; |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup | REV0 | Conversion Tutorials | 129 | 21-05-2021 05:51 |
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup | REV0 | Conversion Tutorials | 51 | 26-03-2015 06:57 |
Frequently Asked Questions | Joe Forster/STA | PC Games - Frequently Asked Questions | 0 | 29-11-2005 09:48 |