Im creating custom controls and I need to use my own windows procedure.
I know I can replace the winproc using something like
SetWindowLong(m_hwnd, GWL_WNDPROC, AddressOf CtrlHandler)
But I can only get it to work with the Ctrlhandler function in a module.
How can I get this to work so I can have my message handler in the class?? Is it possible?
Last edited by packetVB; May 17th, 2004 at 06:55 AM.
Public Function CreateTextBox(pLeft As Long, pTop As Long, pWidth As Long, pHeight As Long, pHwnd As Long, pText As String, CtrlID As Long, ExtraStyle As Long) As Long
m_parentHwnd =pHwnd
ReturnValue = CreateWindowEx(ExStyle, "EDIT", pText, WS_VISIBLE Or WS_CHILD Or ES_LEFT Or WS_TABSTOP Or ExtraStyle, pLeft, pTop, pWidth, pHeight, pHwnd, CtrlID, App.hInstance, ByVal 0)
if Returnvalue=0 then exit function
m_hwnd = ReturnValue
'now that we created the window put the ObjectPtr (which is pointer to this class object)
'into the GWL_USERDATA of the window
SetWindowLong m_hwnd, GWL_USERDATA, ObjectPtr
'the CtrlHandler is responsible for sending message to correct