|
Public Declare Function FlashWindow Lib "user32" _
(ByVal hwnd As Long, ByVal Invert As Long) As Long Public Declare Function CallWindowProc Lib "user32" _ Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _ ByVal hwnd As Long, ByVal Msg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function SetWindowLong Lib "user32" _ Alias "SetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Const GWL_WNDPROC = -4 Global lpPrevWndProc As Long '-PUT THIS PART IN A MODULE------------- Function WindowProcedure(ByVal hw As Long, ByVal uMsg As _ Long, ByVal wParam As Long, ByVal lParam As Long) As _ Long Select Case uMsg 'Cases comes from WinSPY Case 513: Form1.Text1.Text = _ "WWW.Planet-Source-Code.com - for al your code" Case 516: Form1.Text1.Text = _ "This example is from PLANET SOURCE CODE" WindowProcedure = -1 '= If you click Then WindowProcedure gets the 'command and not the Textbox Exit Function Case Else End Select WindowProcedure = CallWindowProc(lpPrevWndProc, hw, _ uMsg, wParam, lParam) End Function Public Sub Hook() lpPrevWndProc = SetWindowLong(Form1.Text1.hwnd, GWL_WNDPROC, _ AddressOf WindowProcedure) End Sub Public Sub Unhook() Dim temp As Long temp = SetWindowLong(Form1.Text1.hwnd, GWL_WNDPROC, lpPrevWndProc) End Sub '-PUT THIS IN FORM1, Create a COMMAND1, COMMAND2, TEXT1 Private Sub Command1_Click() Hook End Sub Private Sub Command2_Click() Unhook End Sub '----RUN IT AND SEE IT. '((((DO NOT FORGET TO PRESS COMMAND2 IF EXIT))) Private Sub Command1_Click() 'Search for TEXT1.HWND and change this to 'any control of your project or the handler 'of a windows control if you know it. End Sub Private Sub Command2_Click() Unhook ' It disables the connection to a control End Sub |