Help using Addressof operator

O

owais

I have one vb6 application in which it uses one variable

Private m_wndprcNext

and uses in

SetWindowLong hWndCur, GWL_WNDPROC, m_wndprcNex

one other calling of method is in same clas

Sub SubClass(hwnd&
m_wndprcNext = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf CtlProc
End Su

when i convert it into VB.NET the error is for Addressof CtlProc which was resolve

I can declare it with delegat

like thi

Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Intege
Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal attr As Integer, ByVal lVal As SubClassProcDelegate) As Intege

please give me the solution what about the declration of below method calling?

SetWindowLong hWndCur, GWL_WNDPROC, m_wndprcNex

m_wndprcNext is the pointer variable as mention above

Please help me in this regard. its an urgen

Thank
owais
 
K

Ken Tucker [MVP]

Hi,

Little confused by this question. The setwindowlong does
not have a call back function. Here is an example that will find the
outlook express window and minimize it.


Api declares and constants


Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As IntPtr, ByVal nIndex As Integer, _

ByVal dwNewLong As Integer) As Integer



Const WS_MINIMIZE As Integer = &H20000000

Const GWL_STYLE As Integer = (-16)



How to find and minimize



For Each p As Process In Process.GetProcessesByName("msimn")

SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_MINIMIZE)

Next



Ken

-----------------------
I have one vb6 application in which it uses one variable

Private m_wndprcNext&

and uses in

SetWindowLong hWndCur, GWL_WNDPROC, m_wndprcNext

one other calling of method is in same class

Sub SubClass(hwnd&)
m_wndprcNext = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf CtlProc)
End Sub

when i convert it into VB.NET the error is for Addressof CtlProc which was
resolved

I can declare it with delegate

like this

Delegate Function SubClassProcDelegate(ByVal hwnd As Integer, ByVal msg As
Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Declare Function SetWindowLong Lib "USER32.DLL" Alias "SetWindowLongA"
(ByVal hwnd As Integer, ByVal attr As Integer, ByVal lVal As
SubClassProcDelegate) As Integer


please give me the solution what about the declration of below method
calling?

SetWindowLong hWndCur, GWL_WNDPROC, m_wndprcNext

m_wndprcNext is the pointer variable as mention above.

Please help me in this regard. its an urgent

Thanks
owais
 
H

Herfried K. Wagner [MVP]

owais said:
I have one vb6 application in which it uses one variable

Private m_wndprcNext&

and uses in

SetWindowLong hWndCur, GWL_WNDPROC, m_wndprcNext

one other calling of method is in same class

Sub SubClass(hwnd&)
m_wndprcNext = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf CtlProc)
End Sub

You may want to override the form's 'WndProc' method instead of using
'SetWindowLong' to use your own window procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top