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
LVL 5
KDivadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcriderCommented:
Try reading the following Microsoft KB Articles:

HOWTO: Hook Into a Window's Messages Using AddressOf
http://support.microsoft.com/support/kb/articles/Q168/7/95.asp?LNG=ENG&SA=MSDN 
 
HOWTO: Position a MsgBox Using a Windows Hook Procedure
http://support.microsoft.com/support/kb/articles/Q180/9/36.ASP?LNG=ENG&SA=MSDN 
 
HOWTO: Subclass a VB Form Using 16-Bit VB CDK Custom Control
http://support.microsoft.com/support/kb/articles/Q140/8/83.asp?LNG=ENG&SA=MSDN 
 
HOWTO: Build a Windows Message Handler with AddressOf in VB
http://support.microsoft.com/support/kb/articles/Q170/5/70.ASP 

HOWTO: Subclass a UserControl
http://support.microsoft.com/support/kb/articles/Q179/3/98.ASP?LNG=ENG&SA=MSDN 
 

Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KDivadAuthor Commented:
You've answered number 1.
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.
0
mcriderCommented:
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!


0
KDivadAuthor Commented:
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
0
mcriderCommented:
Glad I could help! Thanks for the points...


Cheers!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.