Announcement

Collapse
No announcement yet.

WM_SetCurosr

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • WM_SetCurosr

    In an app I display a large cursor. I'd like to allow the border resizing icons to appear. This seems to work, based on what I found at MSDN.

    Code:
             If Lo(Word,Cb.LParam) = %HTBottomRight Then Exit Function
             If Lo(Word,Cb.LParam) = %HTBottomLeft  Then Exit Function
             If Lo(Word,Cb.LParam) = %HTTopLeft     Then Exit Function
             If Lo(Word,Cb.LParam) = %HTTopRight    Then Exit Function
             If Lo(Word,Cb.LParam) = %HTTop         Then Exit Function
             If Lo(Word,Cb.LParam) = %HTBottom      Then Exit Function
             If Lo(Word,Cb.LParam) = %HTLeft        Then Exit Function
             If Lo(Word,Cb.LParam) = %HTRight       Then Exit Function
             If BigCursor Then SetCursor hCursor : Function = 1                 'hCursor is the desired cursor. BigCursor toggle whether to display the big cursor.
    That seems like a lot of testing just to know if the mouse was over the border, so that a sizing icon can be displayed.

  • #2
    Code:
       CASE %WM_SETCURSOR 'wParam = hCtrl, lParamLo = Hit-test, lParamHi = msg-id
         LOCAL HitTest AS WORD
         HitTest = LO(WORD, CBLPARAM)
         IF HitTest = %HTLEFT        OR _
            HitTest = %HTRIGHT       OR _
            HitTest = %HTTOP         OR _
            HitTest = %HTBOTTOM      OR _
            HitTest = %HTTOPLEFT     OR _
            HitTest = %HTTOPRIGHT    OR _
            HitTest = %HTBOTTOMLEFT  OR _
            HitTest = %HTBOTTOMRIGHT THEN
           SetCursor(LoadCursor(%NULL, BYVAL %IDC_NO))
           FUNCTION = %TRUE 'Will prevent window to reset cursor to default arrow
         END IF
    Last edited by Pierre Bellisle; 5 Dec 2018, 03:38 PM.

    Comment


    • #3
      Howdy, Pierre!
      Thanks for the suggestion. Didn't you mean to include %HTTOP?

      But even so, my earlier tests showed that those 4 alone will not expose the corner resize icon. Can you confirm that on your end?

      Comment


      • #4
        Hey,
        Due to popular demand, code was updated to include the whole sizing family...

        Comment


        • #5
          I would have thought the API would offer a single parameter to do the task, instead of having to use 8!

          Comment


          • #6
            Code:
            IF HitTest >= %HTLEFT AND HitTest <= %HTBOTTOMRIGHT THEN ...

            Comment


            • #7
              Hey Pierre!
              Very cool. I've used such a trick on my own equates, but in this case I did not think to do it on equates from MSDN!

              Since Gates assigned sequential values to the 8 equates of interest, with none of the other equates within that group, he must have actually thought ahead to someone wanting to do as you just demonstrated!

              Thanks Pierre and thanks Bill Gates!

              Comment

              Working...
              X