2013-06-20 78 views
0

請幫忙!在NSIS,我使用在自定義用戶界面中找不到IDOK(1)!如何在NSIS中添加自定義確定按鈕?

!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow 

然後

Function LicenseShow 

    ; New dialog for custom items 
    nsDialogs::Create 1018 
    Pop $0 

    ; Accept button 
    ${NSD_CreateButton} 373, 223, 50, 14 "Accept" ; Can't find IDOK (1) in the custom UI! 

    ; Decline button 
    ${NSD_CreateButton} 21, 223, 50, 14 "Decline" 

    ; Picture 
    ${NSD_CreateBitmap} 5 5 100% 100 "disclosure.bmp" 
    Pop $0 
    ${NSD_SetImage} $0 $PLUGINSDIR\image.bmp $ImageHandle 

    ; Disclaimer 
    nsDialogs::CreateControl /NOUNLOAD ${__NSD_Text_CLASS} ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_WANTRETURN}|${ES_MULTILINE} ${__NSD_Text_EXSTYLE} 5 220 660 115 '' 
    Pop $1 
    SendMessage $1 ${EM_SETREADONLY} 1 0 
    SetCtlColors $1 0x000000 0xFFFFFF 
    ${NSD_SetText} $1 "The license text" 

    nsDialogs::Show 
    ${NSD_FreeImage} $ImageHandle 

FunctionEnd 

我如何告訴接受按鈕的上面有IDOK?

請幫忙。

回答

0

你可以通過調用System::Call 'user32::SetWindowLong(i $myhwnd,i -12,i $mynewid)'設定的ID,但你真正應該做的是設置回調函數:

... 
${NSD_CreateButton} ... 
pop $0 
${NSD_OnClick} $0 userclicked 
... 
Function userclicked 
MessageBox mb_ok Hello 
SendMessage $hwndparent ${WM_COMMAND} 1 0 
FunctionEnd