zwuba
26th November 2004 10:55 UTC
Automatically pressing "Install" causes strange installer behaviour
Hi @ll,
I've written an installer which able to start automatically by passing "Silent" as startup parameter. If that parameter is detected I do the following:
!define MUI_PAGE_CUSTOMFUNCTION_SHOW myGuiInit
Function myGUIInit
StrCmp $SilentButGUIMode "Disabled" "Done"
Call StartInstallation
Done:
FunctionEnd
Function StartInstallation
Push $0
FindWindow $0 "#32770" "" $HWNDPARENT
IntCmp $0 0 done
GetDlgItem $0 $HWNDPARENT "1"
SendMessage $0 ${WM_LBUTTONDOWN} "0x0001" 1
SendMessage $0 ${WM_LBUTTONUP} 0 1
done:
Pop $0
FunctionEnd
So far so good but during installation I get strange errors like "Unable to write file C:\Temp\nsisdt.dll" and sometimes the installer crashes completely!
I expect there is a timing problem or do I've to send other window messages too??
best greetz
zwu
kichik
26th November 2004 10:59 UTC
Why not use the built-in /S flag?
zwuba
26th November 2004 11:20 UTC
Well the reason is cause I'm performing many steps for creating a huge backup incl. SQL Server, registry ... and if there is an error I need the details which are saved to log file using "ExportLog". If I'm using the /S option it works of course but in error cases no log file will be created because this "ExportLog" does only export the value of the ListBox to a specific file and if there is no user interface there is also no ListBox ... :cry:
kichik
26th November 2004 11:25 UTC
Then you should skip all unrequired pages using a call to Abort in their pre function. It's always safer to use existing tools than programmatically playing around with the GUI.
zwuba
26th November 2004 11:41 UTC
Oh man that's easy ... damn I think my mind was just locked up thinking about that stupid Install button ... thx for your help now it's running as expected :):up:
Anders
26th November 2004 22:24 UTC
if u wanted to emulate a click u could use WM_COMMAND