Re: UserControl Subclassing
- From: Lorin <Lorin@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 2 Nov 2008 16:41:01 -0800
Cannot find book. Would buy if I could.
CD not with book any more.
Some of the links on his site are dead and others lead to defunct sources.
May be out of print now.
I have many hours invested in my current code.
But I would like o explore oher "sources"
Can the Curland code be found?
I looked around for it before posting earlier but couldn't
find a valid link to the Black Belt code download from 8/01
that I mentioned before. My link to fawctte.com yields "connection
was refused" in K-Meleon, so maybe their whole site is offline.
Fawcette publishing used to have all of the code downloads.
Now the old links redirect to http://visualstudiomagazine.com/,
and MS seems to have made a point of removing any pre-.Net
code samples from there.
I also came across this link where Matthew Curland explains
The other place to get the code is in his book, Advanced
Visual Basic 6. He also provides some sample controls on
the CD, which are handy. The code for a UC to subclass
itself is extremely simple, but Curland's sample is helpful
because he also provides info. on exactly how to set it
up from within the control and how to deal with a handful of
You can find info. about buying the book here:
(Well worth it.)
Curland also provides a DLL for use in the IDE, which is
equivalent to the VBAccelerator DLL. It works to prevent
crashing in the IDE. You can break and resume after fixing
code. You just can't "End". Whereas without a DLL like that
you end up taking down the IDE if you have any runtime
error at all.
But that's really two things: 1) A DLL to reduce crashing
when working with subclasses. 2) The ability to make a
UC subclass itself.
It might be better if you detail what you're subclassing
and what exactly you need. It may vary with different
things. WM_RBUTTONUP should be the message for
right mouseup. To check Shift, Ctrl, Alt you can use
GetKeyState, though I don't know for certain that you
can do that with mouse actions. Normally you'd be
checking that on KeyDown. Is that what you meant?
I don't think the behavior is always consistent. For instance,
I use my own version of an owner-drawn RTB and found that
while v. 2+ receives WM_LBUTTONUP, v. 1 does not and I
have to discern the action through the WM_CAPTURECHANGED
event. I don't know how common such anomalies are.
Also, if you don't know about Matthew Curland's code to
subclass UCs you might want to look it up. It's in his book
and also in a Black Belt article titled Provide Pointers to Class
Functions from 8/01. Unfortunately, the Fawcette site that
used to host the code seems to be kaput and the MS
site that now hosts downloads
seems to only have code back to about 2004.
Matthew Curland came up with an exotic, yet simple, method
that uses a bit of inline assembly code to enable UCs to subclass
themselves. With just a few lines in a separate module you can
create as many UCs in a project as you like and not worry
about the subclass functions for them becvause the WindowProc
function(s) runs inside the UC itself. It's very nice, making custom,
subclassed controls almost as easy to use as intrinsic controls
from the "toolbox".
I am fiddling with a user control and have some code to do subclassing
Ithe Mouse and Mouse+Key events.
Need all the Mouse clicks and wheel scrolling.
Need key Shift, Ctrl, Alt + Mouse actions.
Unfortunately the code I am playing with is missing some of these and
likecannot see where to get these.
Where can I find a sample subclassing code module that does all that?
I can post what I have, but I am not sure if anyone but the author can
The code I have works very well except for the few missing operations
It has LeftClick MouseUp.
The code never returns anything for RightClick MouseUp.
Well, I do get a mousemove event for some reason.
Not sure how to differential from a ral mousemove.
This has been fun debugging but I am at the end of my trail.
Any help would be much appreciated.
- Prev by Date: Re: UserControl Dragging
- Next by Date: Re: UserControl Subclassing
- Previous by thread: Re: UserControl Subclassing
- Next by thread: Re: UserControl Subclassing