Archive: langstring ignored in .onInit


langstring ignored in .onInit
I am using the mutex detect function to see if my installer is running, which works great, but I want to have the correct language used for the messagebox warning. At the moment the LangString is ignored by the .onInit function, is there a way around this?

I am using 2.0b4.
I have attached an example script so you can see what I'm getting at.
Firewall blocked it, added as code:

LangString InstallerRunning ${LANG_ENGLISH} "English: The installer is already running."
LangString InstallerRunning ${LANG_FRENCH} "French: The installer is already running."
LangString InstallerRunning ${LANG_GERMAN} "German: The installer is already running."
LangString InstallerRunning ${LANG_DUTCH} "Dutch: The installer is already running."
LangString InstallerRunning ${LANG_HEBREW} "Hebrew: The installer is already running."

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "LangString") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK $(InstallerRunning)
Abort
FunctionEnd


edited by kichik, script attached below

See the following thread:

http://forums.winamp.com/showthread....String+.oninit


Thanks. Any plans to change this behaviour?


Put the code in a custom GUIINIT function and it will work.


Originally posted by zarged
Thanks. Any plans to change this behaviour?
Yes, though I'm not sure when exactly. .onGUIInit isn't called when the installer is silent so it's not the best solution.

I just use a custom page as the first page which does the checks I want with the correct language in any message boxes. Its not a problem as such but would seem neater, IMHO, if it could be in onInit section instead but this is in no way urgent or anything :D

Keep up the good work.


You can use .onGuiInit or a Modern UI custom GUIINIT function, that's easier than adding an extra page.

The disadvantage of both methods is that is doesn't work in silent mode.