Archive: NSIS and GetDlgItem


NSIS and GetDlgItem
  Hi Guys,

I have an installer script and I'm looking at adding Tooltips to some icons I have inserted into a custom page.

The page is called as follows:


Page custom Custom_Component 

>
Function:

Custom_Component

Call show_configuration
FunctionEnd

>Function show_configuration
Pop $hwnd
FindWindow$3 "#32770" "" $HWNDPARENT
GetDlgItem$1 $3 1210 ;Field 9
MessageBox MB_OK "1 is $1 - 3 is $3"

>ToolTips::Modern $1 ${TTM_ALERTICON} "Alert" "Testing Test" 0x00896845 0x00FCEFE4 "Times New Roman" 15
!insertmacro MUI_HEADER_TEXT "Configuration" ""
!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "config_page.ini"
!insertmacro MUI_INSTALLOPTIONS_READ $4 "config_page.ini" "Field 2" "State"

!insertmacro MUI_INSTALLOPTIONS_SHOW


Pop $R0
${If} $R0 == "success"
Call config_validation
${ElseIf} $R2 == 1
Call show_configuration
${ElseIf} $R0 == "back"
${else}
Quit
${EndIf}
>FunctionEnd
>
The page config is loaded oninit:


onInit

InitPluginsDir
File/oname=$PLUGINSDIRconfig_page.ini "config_page.ini"
>FunctionEnd
>
On the Popup $1 = nothing and $3 = a random string of numbers

I presume I'm doing something wrong, can anyone point me in the right direction?

Thanks.

FYI the plugins are loaded via in the oninit function:

File /oname=$PLUGINSDIR\InstallOptions.dll "${NSISDIR}\Plugins\InstallOptions.dll"
File /oname=$PLUGINSDIR\ToolTips.dll "${NSISDIR}\Plugins\ToolTips.dll"


You should really move to MUI2 and nsDialogs.. much easier to keep track of things then :)

That said... looks like you might be trying to get the dialog item before the dialog exists?

Use INSTALLOPTIONS_INITDIALOG to initialize the dialog in memory first (it exists, but isn't displayed), then you can get at the dialog item (I *think* the hwnd is stored in your installoptions INI file as well, so that might be an easier way to read it than using GetDlgItem and such), hook the tooltip onto it, and then display the dialog with INSTALLOPTIONS_SHOW .

P.S. Be sure to read the Tooltips wiki page for notes on Vista, Win7 and balloon style (modern) tooltips:
http://nsis.sourceforge.net/ToolTips_plug-in


Originally posted by voxio
FYI the plugins are loaded via in the oninit function:

File /oname=$PLUGINSDIR\InstallOptions.dll "${NSISDIR}\Plugins\InstallOptions.dll"
File /oname=$PLUGINSDIR\ToolTips.dll "${NSISDIR}\Plugins\ToolTips.dll"
This is unnecessary. NSIS automatically places the plugins DLL inside the installer and extracts them to PLUGINSDIR when needed.