Originally posted by Michael Mattias
View Post
Announcement
Collapse
No announcement yet.
Subclassing: CallWindowProc using a method?
Collapse
X
-
-
Um, so what is the problem?
Calll me overly optimistic, but it sure looks like you have everything managed in the subclass procedure.
Leave a comment:
-
Originally posted by Michael Mattias View Post???
Code:function WndProc(byval hWnd as dword, byval wMsg as dword, byval wParam as dword, byval lParam as long) as long .... static wlx as long .... select case wMsg case 0 ' special case - the winlet is sending its id ' or -1 if it is no longer selected if hWnd = 0 then select case wparam case 0 wlx = lparam case -1 wlx = -1 end select end if exit function ' do NOT pass the event on to the classproc ' case someothermessage if wlx > -1 then gWL(wlx).someothermethod ....
Leave a comment:
-
as there are lots of class members in the array, it has to know which one to call
You know the message, and SetWindowLong(hWnd, GWL_USERDATA) can hold all kinds of info re the 'state' of the program and/or main window.
Code:FUNCTION SubClassProc ( hWnd, uMSG...) CASE message_of_interest My_data = GetWindowLong (getParent(hWnd), GWL_USERDATA) SELECT CASE My_data case 1 Z = object.method_one case 2 Z = object.method_two ... FUNCTION= CallWindowProc (dwOldProc, hWnd...........
Leave a comment:
-
Originally posted by Michael Mattias View PostCall me simple, but why not just have the subclass proc call (right word?) the method?
Leave a comment:
-
Call me simple, but why not just have the subclass proc call (right word?) the method?
Leave a comment:
-
Edwin, I thought about it but as it happens I have a global array of the class in question so I can just send a message to the subclass function with the index of the class member.
Leave a comment:
-
Subclassing: CallWindowProc using a method?
Can I CallWindowProc using a method rather than a function, to subclass a window?
Compiler doesn't like the "dot" here (error 526 Period not allowed):
Code:GrOldProc = SetWindowLong(hGW, %GWL_WNDPROC, codeptr(me.MethodGrProc)) ' Subclasses Graphic control
Tags: None
Leave a comment: