Custom Processing Forms Mobile Message WM

xiaoxiao2021-03-06  15

Standard module:

Public Declare Function GetWindowlong Lib "User32" Alias ​​"getWindowlonga" (Byval Nindex as long) As long

Public Declare Function CallWindowProc LIB "User32" Alias ​​"CallWindowProca" (Byval Hwndfunc As Long, Byval Hwnd As Long, Byval Msg As Long, Byval WParam As Long) As long

Public Declare Function SetWindowlong Lib "User32" Alias ​​"SetWindowlonga" (Byval Nindex As Long, Byval Dwnewlong As Long) As long

Public const gwl_Wndproc = (-4)

Public const WM_MOVE = & H3

Public Procold As long 'Saves the address of the original form processing

Message callback function

Public Function Sysproc (Byval Hwnd As Long, Byval WParam As Long, BYVAL LPARAM AS Long) As long

Static I as integer, J AS Integer

IF IMSG = WM_MOVE THEN MSGBOX "Move" "Processes custom messages first

Sysproc = CallWindowProc (Procold, HWnd, IMSG, WPARAM, LPARAM)

'Rendering system definition message

END FUNCTION

'window

Private sub flow_load ()

'procold = getWindowlong (me.hwnd, gwl_wndproc)

Procold = setWindowlong (HWND, GWL_WNDPROC, Addressof Sysproc)

'Get the original message to handle the handle and transfer the message to custom functions

End Sub

Private Sub Form_Unload (Cancel AS Integer)

SetWindowlong Hwnd, GWL_WNDPROC, Procold

End Sub

Note: Please do everything

FORM_UNLOAD

Restore the original information processing loop function calls the address, otherwise the program will run out!

转载请注明原文地址:https://www.9cbs.com/read-46566.html

New Post(0)