Re: Non-Client Area Dead after Form is Subclassed
- From: "Karl E. Peterson" <karl@xxxxxxxx>
- Date: Wed, 29 Mar 2006 16:57:34 -0800
Are you returning the value from the default procedure, in those messages
that you're choosing not to process yourself? Without seeing all your code,
guesses are about all that can be offered. For code that's tried-and-true,
no ambiguity there(!), this is what I use:
http://vb.mvps.org/samples/HookMe
--
Working without a .NET?
http://classicvb.org/
Joseph Geretz wrote:
I'm Subclassing a VB6 Form. To eliminate any ambiguity, I'll be
precise: I am replacing the window procedure with my own function.
Here's our function signature. This function is in a BAS module.
(Let's not start *that* discussion, or if you like, fine - but maybe
in a different thread? :-)
Public Function XHookProc(ByVal hWnd As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) _
As Long
O'Reilly calls this Subclassing. Call it as you wish :-)
The code I'm using has been tried and tested for about three years
now. However, up until now, we've only placed such hooks on our own
user controls. Again, to focus in on the issue, I'll be very precise.
Up until now we've only used this code to hook those windows which
are comprised of exclusively client area. No border, no title, and no
menus.
Now for the first time, I'm hooking an entire VB Form. I'm finding
that the hook goes into place properly. I'm getting the notification
for all the messages I expect. I'm not suppressing these messages,
I'm forwarding them on to the default message handler which was in
place at the time I set my own hook into place. Here's what I'm
observing:
All client area widgets behave as expected. Buttons get pressed,
Checkboxes get checked, Textboxes accept text, etc, etc. Meanwhile,
I'm using DebugView from SysInternals and I see a bazillion of my own
messages for intercepted Windows messages being output from my
application. Clearly I'm getting the messages and clearly I'm passing
them on.
However, the non-client area of my form seems to be dead. Here's what
I've observed not working:
Title Bar caption vanishes after another window is dragged across it.
Control Boxes are dead.
Windows border is dead - can't be resized. (Mouse doesn't even change
shape when positioned over border area.)
Message Boxes are dead. MsgBox "Click Me!" effectively locks up the
app, since it can't be dismissed.
Top level menus can't be clicked, although they can be accessed with
their Alt-Key combinations.
I've attached two Log files from Microsoft Spy++ which show a mouse
click on the title area of the form. Before being subclassed, the log
shows hits to what is defined as HTCAPTION - OK, makes sense.
However, after being subclassed, the log shows hits to what is
defined as HTNOWHERE. I suspect that this may be a clue to the
problem.
I've been on this for over a day now. If you can help me out with
this, I'll be most grateful for your assistance.
Thanks!
- Joseph Geretz -
.
- Prev by Date: Re: Font dump questions
- Next by Date: Re: Non-Client Area Dead after Form is Subclassed
- Previous by thread: Re: Font dump questions
- Next by thread: Re: Non-Client Area Dead after Form is Subclassed
- Index(es):
Relevant Pages
|