-
Apr 15th, 2024, 04:28 AM
#41
Re: LabelPlus
 Originally Posted by AngelV
Could you elaborate on this ? Does this method still rely on the label being above the windowless control while leaving some space between the bounding rect of the label and the bounding rectangle of the windowless control?
No, it does not.
The original purpose of SetCapture/ReleaseCapture API functions is to be able to receive WM_MOUSEMOVE on a hwnd (so called capturing window) even when mouse pointer is outside its bounds (not over it). Apparently there can be only one such window per thread/process.
Hot tracking impl in this case is very easy: once mouse is over the hwnd (i.e. on first received WM_MOUSEMOVE) capture the mouse input and switch control to hot state, then on subsequent WM_MOUSEMOVE check if mouse is over the control (because in capture mode the hwnd will receive WM_MOUSEMOVE even if mouse is moving outside hwnd) and if not over the control then release capture and switch to normal state.
Absolutely the same idea is implemented by hosts (VB6 forms, etc. but not MS Access) able to site windowless controls which in turn obviously cannot use SetCapture/ReleaseCapture API functions as there is no separate hwnd for them. The methods are Set/GetCapture on IOleInPlaceSiteWindowless interface on the site. Release of capture is impl with SetCapture(FALSE).
cheers,
</wqw>
-
Apr 15th, 2024, 05:27 AM
#42
Hyperactive Member
Re: LabelPlus
If I understand correctly, the following event handler code (for testing only) should print out the time on the debug window every time the mouse is moved event when outside the Textbox bounderies.
Code:
Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Not pvGetCapture() Then
pvSetCapture True
End If
Debug.Print Time
End Sub
But ,the time is only printed once upon entering the textbox.
I am testing this on an excel userform with a single windowless textbox on it.
-
Apr 15th, 2024, 07:54 AM
#43
Re: LabelPlus
 Originally Posted by AngelV
If I understand correctly, the following event handler code (for testing only) should print out the time on the debug window every time the mouse is moved event when outside the Textbox bounderies.
Code:
Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Not pvGetCapture() Then
pvSetCapture True
End If
Debug.Print Time
End Sub
But ,the time is only printed once upon entering the textbox.
I am testing this on an excel userform with a single windowless textbox on it.
No, this is not what the original code does and besides you cannot implement user-controls in Excel (or VBA) to test it.
The original MouseMove event is a handler in a user-control so pvSetCapture is working on this user-control's site by first casting Me to IOleObject interface, then calling GetClientSite to get its site.
You have to get a reference to the site object of TextBox1 in some way (not easy if possible at all), then cast it to IOleInPlaceSiteWindowless interface, then call SetCapture on this interface to be able to receive TextBox1_MouseMove even if mouse is outside TextBox1 (or outside the form for that matter).
cheers,
</wqw>
-
Apr 16th, 2024, 12:39 AM
#44
Hyperactive Member
Re: LabelPlus
@wqweto
Yep. I just passed the userform as well as the IUnknown of the userform client area but I get error 430 "Class doesn't support automation or doesn't support expected interface"
Thanks for your help.
-
Jan 14th, 2025, 05:06 AM
#45
Member
Re: LabelPlus
Nice job, LeandroA!
Very useful! Thanks!
-
Jan 29th, 2025, 11:58 AM
#46
Fanatic Member
Re: LabelPlus
How can i Fix it as below?
When I set the captionangle value to 90, I expect the control to change 90 degrees, but it doesn't. How can I solve the problem like the image on the right? I know that the GDIP_AddPathString function must change.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|