Kevin_Foley
asked on
.NET DELEGATE issue
I have converted a VB6 project to .NET. I have worked through every issue but one.
Add a delegate for AddressOf fWindowProc
I have read numerous articles and looked at examples. However, when I try to use this code:
I created a delegate
Delegate Function fWindowProcDEL(ByVal hw As Integer, ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
I added those code to my code:
Dim MyDelegate As fWindowProcDEL
MyDelegate = New fWindowProcDEL(AddressOf fWindowProc)
lpPrevWndProc = SetWindowLong(lHwnd, GWL_WNDPROC, MyDelegate)
I get the error: Value of type 'Project1.modMain.fWindowP rocDEL' cannot be converted to Integer
Add a delegate for AddressOf fWindowProc
I have read numerous articles and looked at examples. However, when I try to use this code:
I created a delegate
Delegate Function fWindowProcDEL(ByVal hw As Integer, ByVal uMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
I added those code to my code:
Dim MyDelegate As fWindowProcDEL
MyDelegate = New fWindowProcDEL(AddressOf fWindowProc)
lpPrevWndProc = SetWindowLong(lHwnd, GWL_WNDPROC, MyDelegate)
I get the error: Value of type 'Project1.modMain.fWindowP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
found the answer... had to add .target
ASKER
I have two applications and I'm monitoring the messages in one from the other. (sub class the form to trap for windows messages).
The VB6 code was
lpPrevWndProc = SetWindowLong(lwnd, GWL_WNDPROC, Address of fwindowProc.)
.NET doesn't like the Address of and says I need a delegate.