KDivad
asked on
Subclassing (zero pts for now)
I really have three questions, but they all kinda go together, so I put them all here. I'll increase/split the points depending on who answers what and how well.
#1. Basic subclassing method. I know it involves Get/SetWindowLong, AddressOf, etc., but I can't find my copy of this. Nothing fancy (yet), no subclassing ocxs/dlls/etc., just the basic outline.
#2. What are some possible msgs/lparams(?)/uparams(?) that can be passed to the subclassing procedure? For instance, the message could be the window-resize message and the params would be the new size. I would like a good size list, but I'll spread out points to anyone who can give me a set (msg and BOTH params) that hasn't been posted by someone else and works.
#3. Is it not possible to subclass a window in another app? I have an old VB3 app that I've written and don't feel like converting, but (when I had the subclass routine) when I tried it, the SetWindowLong statement failed (returned zero) and the subclassing didn't work. If it is, any ideas where I went wrong? If not, any ideas how to do the same thing (hooking, maybe?)?
Thanks for any help!
Later,
KDivad Leahcim
#1. Basic subclassing method. I know it involves Get/SetWindowLong, AddressOf, etc., but I can't find my copy of this. Nothing fancy (yet), no subclassing ocxs/dlls/etc., just the basic outline.
#2. What are some possible msgs/lparams(?)/uparams(?)
#3. Is it not possible to subclass a window in another app? I have an old VB3 app that I've written and don't feel like converting, but (when I had the subclass routine) when I tried it, the SetWindowLong statement failed (returned zero) and the subclassing didn't work. If it is, any ideas where I went wrong? If not, any ideas how to do the same thing (hooking, maybe?)?
Thanks for any help!
Later,
KDivad Leahcim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also take a look here:
TN024: MFC-Defined Messages and Resources
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfcnotes_tn024.htm
Sending Messages
http://msdn.microsoft.com/library/books/hcvb/sendingmessages.htm
Your own window procedure
http://msdn.microsoft.com/library/books/hcvb/abasiccwindowclass.htm
By the way, As for #3, I don't think it's possible to subclass another applications window. I may be wrong, but I don't think so...
Cheers!
TN024: MFC-Defined Messages and Resources
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfcnotes_tn024.htm
Sending Messages
http://msdn.microsoft.com/library/books/hcvb/sendingmessages.htm
Your own window procedure
http://msdn.microsoft.com/library/books/hcvb/abasiccwindowclass.htm
By the way, As for #3, I don't think it's possible to subclass another applications window. I may be wrong, but I don't think so...
Cheers!
ASKER
I'm inclined to believe that you can't subclass a window outside your own app. I failed to get it to work and 3 other people (including you) have also said they don't think it's possible. Oh well, it was worth a shot. The only light in the tunnel is one line from the third article you posted: "Keep in mind that you aren’t the only programmer in the world who might be subclassing your window." This would lead one to believe that it is possible, but he(she?) apparently learned all this almost from scratch, so maybe not.
Thanks for the help!
KDivad
Thanks for the help!
KDivad
Glad I could help! Thanks for the points...
Cheers!
Cheers!
ASKER
I've figured out some of number 2.
Number 3 still has me lost. The particular message I want to intercept for the VB3 app is the window resize event. Like I said, the subclassing failed and I don't know if hooking can be used to do this or how. I understand the very basics of hooking but not much more.