Page 2 of 2 FirstFirst 12
Results 41 to 46 of 46

Thread: LabelPlus

  1. #41
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,790

    Re: LabelPlus

    Quote Originally Posted by AngelV View Post
    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>

  2. #42
    Hyperactive Member
    Join Date
    Jun 2022
    Posts
    329

    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.

  3. #43
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,790

    Re: LabelPlus

    Quote Originally Posted by AngelV View Post
    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>

  4. #44
    Hyperactive Member
    Join Date
    Jun 2022
    Posts
    329

    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.

  5. #45
    Member
    Join Date
    Jun 2021
    Location
    Germany
    Posts
    37

    Re: LabelPlus

    Nice job, LeandroA!

    Very useful! Thanks!

  6. #46
    Fanatic Member Black_Storm's Avatar
    Join Date
    Sep 2007
    Location
    any where
    Posts
    591

    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.


Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width