Re: UserControl Subclassing




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.

"mayayana" wrote:


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
his technique:
http://forums.devx.com/archive/index.php/t-38144.html

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
UC quirks.

You can find info. about buying the book here:
http://www.powervb.com/
(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.

"mayayana" wrote:

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
(http://visualstudiomagazine.com/code/)
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".


VB6SP6
I am fiddling with a user control and have some code to do subclassing
for
the 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
I
cannot 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
follow it.
The code I have works very well except for the few missing operations
like
RightClick MouseUp.
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.







.



Relevant Pages

  • Re: generic message handler
    ... I do not want my controls to know about these ... that the parent of each control is unknown. ... > subclass each window and do the message routing via its message maps. ... > there is probably a way you could hook into MFC's hook processing and ...
    (microsoft.public.vc.mfc)
  • NullReferenceException when subclassing with NativeWindow
    ... To subclass form and controls I use a class ... periodically goes through a cycle when it creates one NativeWindow-descendent ... Int32 msg, IntPtr wparam, IntPtr lparam) ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: UserControl Subclassing
    ... Can the Curland code be found? ... He also provides some sample controls on ... Curland also provides a DLL for use in the IDE, ... UC subclass itself. ...
    (microsoft.public.vb.general.discussion)
  • WTL subclassing - a proper way to subclass a gui window along with its children
    ... Let me put it this way; using WTL how do you properly subclass a ComboBoxEx ... and some of the controls in it, so that the code could react to a key stroke ...
    (microsoft.public.vc.atl)
  • WM_COMMAND for sublcassed wnd does not work in menus...
    ... I have a really strange problem: ... What I did was to intercept the PeekMessageA and PeekMessageW API using ... think that it's a problem in the way I subclass it since else this ... I tried to intercept the RegisterClass, and RegisterClassW but the .dll ...
    (microsoft.public.vc.language)