|
另类Msgbox(2) Private Declare Function SetDlgItemText Lib "user32" Alias "SetDlgItemTextA" _ (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpString As String) As Long Private Declare Function GetDlgItemText Lib "user32" Alias "GetDlgItemTextA" _ (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal lpString As String, ByVal nMaxCount As Long) As Long Private hHook As Long Private Const IDOK = 1 Private Const IDCANCEL = 2 Private Const IDABORT = 3 Private Const IDRETRY = 4 Private Const IDIGNORE = 5 Private Const IDYES = 6 Private Const IDNO = 7 Private Const IDPROMPT = &HFFFF&
'----------------------窗体句柄----------------------' Private hFormhWnd As Long ''''''''''''''''''''''''''''''''''''''''''''''''''''' '替代VB中的Msgbox函数 ''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function Msgbox(hWnd As Long, sPrompt As String, _ Optional dwStyle As Long, _ Optional sTitle As String) As Long Dim hInstance As Long Dim hThreadId As Long hInstance = App.hInstance hThreadId = App.ThreadID If dwStyle = 0 Then dwStyle = vbOKOnly If Len(sTitle) = 0 Then sTitle = App.EXEName '将当前窗口的句柄付给变量 hFormhWnd = hWnd '设置钩子 hHook = SetWindowsHookEx(WH_CBT, _ AddressOf CBTProc, _
|