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
kerplunkwhoops@yahoo.co.uk - 15 May 2008 21:03 GMT
Also, here's a similar example of what I am doing, but my hook is on a
Usercontrol not a form.
http://vbnet.mvps.org/index.html?code/forms/scrollviewport.htm
Paul
> Hello
>
[quoted text clipped - 16 lines]
>
> Paul
kerplunkwhoops@yahoo.co.uk - 15 May 2008 21:06 GMT
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
> Hello
>
[quoted text clipped - 16 lines]
>
> Paul
Karl E. Peterson - 15 May 2008 21:27 GMT
> 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.

Signature
.NET: It's About Trust!
http://vfred.mvps.org
Dean Earley - 16 May 2008 10:20 GMT
> Hello
>
[quoted text clipped - 10 lines]
> Usercontrol has moved. The same is true for Usercontrol.Extender.Left/
> Top.
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.

Signature
Dean Earley (dean.earley@icode.co.uk)
i-Catcher Development Team
iCode Systems
kerplunkwhoops@yahoo.co.uk - 16 May 2008 15:38 GMT
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
> kerplunkwho...@yahoo.co.uk wrote:
> > Hello
[quoted text clipped - 25 lines]
>
> iCode Systems
expvb - 16 May 2008 17:13 GMT
Try searching the newsgroup for "vb drag UserControl" to see if there are
alternatives.