vsrinivasan
New member
- Joined
- Feb 3, 2005
- Messages
- 1
- Programming Experience
- Beginner
Hi,
I am new to windows programming. I am trying to capture a WM_USER message in a VB.Net Windows application. This is what I am doing in my class:
DeclareFunction SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd AsLong, ByVal nIndex AsLong, ByVal dwNewLong AsLong) AsLong
PublicConst GWL_WNDPROC = -4
PublicShared lpPrevWndProc AsLong
Public gHW AsLong
In my Form_Load procedure I am calling SetWindowLong as follows:
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, AddressOf WindowProc)
I am getting the following error:
"AddressOf expression cannot be converted to Long datatype."
If I replace the argument dwNewLong with a delegate type (the same as the callback function) then I do not get the compile error but the WindowProc function (the callback) does not get called.
Can anyone please help me? I have been working on this for days now.
Thanks much in advance.
Veena
I am new to windows programming. I am trying to capture a WM_USER message in a VB.Net Windows application. This is what I am doing in my class:
DeclareFunction SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd AsLong, ByVal nIndex AsLong, ByVal dwNewLong AsLong) AsLong
PublicConst GWL_WNDPROC = -4
PublicShared lpPrevWndProc AsLong
Public gHW AsLong
In my Form_Load procedure I am calling SetWindowLong as follows:
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, AddressOf WindowProc)
I am getting the following error:
"AddressOf expression cannot be converted to Long datatype."
If I replace the argument dwNewLong with a delegate type (the same as the callback function) then I do not get the compile error but the WindowProc function (the callback) does not get called.
Can anyone please help me? I have been working on this for days now.
Thanks much in advance.
Veena