[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] GWL_WNDPROC [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = -4[/size]
[size=2]
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Declare [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] SetWindowLong [/size][size=2][color=#0000ff]Lib[/color][/size][size=2] "user32.dll" [/size][size=2][color=#0000ff]Alias [/color][/size][size=2]"SetWindowLongA" ([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] hwnd [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] nIndex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] dwNewLong [/size][size=2][color=#0000ff]As[/color][/size][size=2] WProc) [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2]
[/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Delegate [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] WProc([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] pHWnd [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] pMsg [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] wParam [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] lParam [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2]) [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size]
[size=2][color=#0000ff]
[/color][/size][size=2][color=#0000ff]Private[/color][/size][size=2] FPrevWinProc [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size]
[size=2][color=#0000ff]
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] WinProc([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] pHWnd [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] pMsg [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] wParam [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] lParam [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2]) [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Integer[/color][/size]
[size=2][color=#0000ff]
[/color][/size]
[size=2][color=#008000]
[/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Function[/color][/size]
[size=2][color=#0000ff]
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click[/size]
[size=2]
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] FWinHandle [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = [/size][size=2][color=#0000ff]MyBase[/color][/size][size=2].Handle.ToInt32[/size]
[size=2]
FPrevWinProc = SetWindowLong(FWinHandle, GWL_WNDPROC, [/size][size=2][color=#0000ff]AddressOf[/color][/size][size=2] WinProc)[/size]
[size=2]
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub
[/color][/size]