Adam, Thank you very much for the code. If you use #include "win32api.inc", you don't need #include "ddt.inc". What about push buttons? Jeffrey.
------------------
------------------
Case %IDOK, 130 'OK 'Resume normal procedure after install is complete: If g_lInstallingFlag = 1 Then g_lInstallingFlag = 0 SaveSetting %HK,g_sInstKey,"ApplicationName",g_sWinLogEXE SaveSetting %HK,g_sInstKey,"DisplayName",g_szMINE SaveSetting %HK,g_sInstKey,"UninstallString",g_sWinLogFilePath & "wUnwise.exe" SaveSetting %HK,g_sMainKey, g_sInstallDir,g_sWinLogFilePath End If 'Click the Apply button If IsWindowEnabled(GetDlgItem(CbHndl,132)) Then SendMessage GetDlgItem(CbHndl,132) , %BM_CLICK, 0, 0 Dialog End CbHndl, 1 Exit Function
#Compile Exe #Register None #Dim All #Include "win32Api.inc" Global ghKbrdHook As Long Global lpfnKbrdHook As Long Global hDlg As Long Function KeyboardHook(ByVal iCode As Integer, ByVal wParam As Long, ByVal lParam As Long) As Dword If iCode = %HC_ACTION Then Select Case wParam Case %VK_NUMPAD1 To %VK_NUMPAD9 ' NumPad 1-9 If (lParam And &H80000000) = 0 Then _ Control Send hDlg, wParam - %VK_NUMPAD1 + 101, %BM_CLICK, 0, 0 End Select Function = 1: Exit Function ' sample of ignoring !!! End If Function = CallNextHookEx(ghKbrdHook, iCode, wParam, lParam) End Function CallBack Function Cb Select Case CbMsg Case %WM_INITDIALOG ghKbrdHook = SetWindowsHookEx(%WH_KEYBOARD, CodePtr(KeyboardHook), _ 0, GetCurrentThreadId) Case %WM_DESTROY: UnhookWindowsHookEx ghKbrdHook Case %WM_COMMAND If CbCtl >=101 And CbCtl <= 109 Then _ SetWindowText CbHndl, "[" + Str$(CbCtl - 100) + " ] " + Time$ End Select End Function Function PbMain Local i As Long Dialog New 0,"Test",,, 100, 180, %ws_sysmenu To hdlg For i = 1 To 9 Control Add Button, hdlg,100+ i, "Button" + Str$(i), 10, i * 15 - 10, 80, 12, %WS_BORDER Next Dialog Show Modal hdlg Call Cb End Function
#Compile Exe #Register None #Dim All #Include "win32Api.inc" Global gHook As Long Global hDlg As Long Sub ButtonClicked (i As Integer) SetWindowText hDlg, "Button" + Str$(i) + " " + Time$ End Sub Function SysMsgProc(ByVal nCode As Integer, ByVal wParam As Long, Msg As tagMsg Ptr) As Long If nCode = %MSGF_DIALOGBOX Then If @Msg.Message = %WM_CHAR Then Select Case Chr$(@Msg.wParam) Case "1" To "9" ButtonClicked @Msg.wParam - Asc("0") Function = 1: Exit Function ' sample of ignoring !!! End Select End If End If Function = CallNextHookEx(gHook, nCode, wParam, Msg) End Function CallBack Function Cb Select Case CbMsg Case %WM_INITDIALOG gHook = SetWindowsHookEx(%WH_MSGFILTER, CodePtr(SysMsgProc), _ 0, GetCurrentThreadId) Case %WM_DESTROY: UnhookWindowsHookEx gHook Case %WM_COMMAND If CbCtl >= 101 And CbCtl <= 109 Then ButtonClicked CbCtl - 100 End Select End Function Function PbMain Local i As Long Dialog New 0,"Test",,, 100, 180, %ws_sysmenu To hdlg For i = 1 To 9 Control Add Button, hdlg,100 + i, "Button" + Str$(i), 10, i * 15 - 10, 80, 12, %WS_BORDER Next Dialog Show Modal hdlg Call Cb End Function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment