AddressOf NewWindowProc?

dynamic_sysop

Senior Contributor
Joined
Oct 1, 2002
Messages
1,039
Location
Ashby, Leicestershire.
hi again , i'm trying to impliment a "SetWindowLong" in vb.net , however i need to use the "AddressOf NewWindowProc" , but i get an error that it cant convert an "AddressOf" to a long:confused:
is there an equivalent in Dot Net? my test to see if i could get it to work ( in a module ) is this...
Visual Basic:
    Public Function NewWindowProc(ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
        Try
            Select Case msg
                Case WM_NCPAINT
                    Debug.Write("WM_PAINT " & wParam)
                Case WM_LBUTTONUP
                    Debug.Write("WM_LBUTTONUP " & wParam)
                Case Else
                    NewWindowProc = CallWindowProc(OldWindowProc, hwnd, msg, wParam, lParam)
            End Select
            DefWindowProc(hwnd, msg, wParam, lParam)
        Catch
            Debug.Write("An Error has occurred")
        End Try

    End Function
and on the form ( in a button_click ) this...
Visual Basic:
OldWindowProc = SetWindowLong(TextBox1.Handle.ToInt32, GWL_WNDPROC, "  THIS IS WHERE THE ADDRESSOF SHOULD GO")'// HERE IT SAYS THAT I CANT USE ADDRESSOF
any help appreciated thanx.
 
The correct way to subclass in the .NET framework is to inherit from that control and override the WndProc method.
 
Back
Top