Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hooking WM_NCHITTEST or Usercontrol does not affect Left and Top

0 views
Skip to first unread message

kerplun...@yahoo.co.uk

unread,
May 15, 2008, 3:59:30 PM5/15/08
to

Hello

I am having a few issues when hooking WM_NCHITTEST in VB6 then reading
the new values given to Left and Top of a Usercontrol.

My Windows hook returns HTCAPTION for WM_NCHITTEST when the user
clicks on the Usercontrol. This has the affect of moving the
Usercontrol like dragging a form border.

The hook works correctly and the Usercontrol visually moves on the
form, but the values in Left and Top for the Usercontrol on the parent
form never changes. Its as if VB6 is never being informed that the
Usercontrol has moved. The same is true for Usercontrol.Extender.Left/
Top.

Any suggestions?

Thanks

Paul

Message has been deleted

kerplun...@yahoo.co.uk

unread,
May 15, 2008, 4:06:41 PM5/15/08
to

Also, here's a similar example of what I'm doing, but my hook is on a
Usercontrol not a Form.

http://vbnet.mvps.org/index.html?code/subclass/htcaption.htm

Paul

Karl E. Peterson

unread,
May 15, 2008, 4:27:49 PM5/15/08
to
kerplun...@yahoo.co.uk wrote:
> The hook works correctly and the Usercontrol visually moves on the
> form, but the values in Left and Top for the Usercontrol on the parent
> form never changes. Its as if VB6 is never being informed that the
> Usercontrol has moved.

That actually makes sense. Same thing happens if you manually sort a ListView. VB
is keeping all these internal tables, and they're not actually truth-checked more
often than not. May be that you have to live with this.
--
.NET: It's About Trust!
http://vfred.mvps.org


Dean Earley

unread,
May 16, 2008, 5:20:39 AM5/16/08
to

User control hosting and placement does not use the standard window
positioning.
When the control is moved, it changes the windowrect, but not the other
way around.

If I want a UC to move itself, I had to manually handle mousedown/move
and chenge the extender top and left.

--
Dean Earley (dean....@icode.co.uk)
i-Catcher Development Team

iCode Systems

kerplun...@yahoo.co.uk

unread,
May 16, 2008, 10:38:14 AM5/16/08
to

My soultion was to use GetWindowRect to get the position of the Form
and the Usercontrol. Its not perfect, but I only need to know a
relative position so it works for my requirements.

Paul


On 16 May, 10:20, Dean Earley <dean.ear...@icode.co.uk> wrote:

> Dean Earley (dean.ear...@icode.co.uk)

expvb

unread,
May 16, 2008, 12:13:44 PM5/16/08
to
Try searching the newsgroup for "vb drag UserControl" to see if there are
alternatives.


0 new messages