Announcement

Collapse
No announcement yet.

Mouse messages in a Dialog

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

  • Mouse messages in a Dialog

    Is it possible to get the messages %WM_MOUSEMOVE, %WM_LBUTTONDOWN and
    %WM_LBUTTONUP messages sent to a DialogProc? You can get %WM_NCHITTEST
    everytime the mouse is moved or a button pressed, but this gives the
    mouse position only and does not say whether it was triggered by a mouse
    move or button click.

  • #2
    Interesting question, I decided to throw a Control Send in and it failed.
    I'm not sure why just yet, but the SendMessage piece works, try that, it's commented out below

    Code:
    CallBack Function DialogProc() As Long 'For hDlg
      Local wMsg            As Long
      Local wParam          As Long
      Local lParam          As Long  
    
      wMsg = CbMsg
      lParam = CbLparam
      wparam = CbWparam
    
      Select Case wMsg
    
        Case %WM_MOUSEMOVE
          zText = "Mouse Position:" + Str$(LoWrd(lParam)) + ","+Str$(HiWrd(lParam))
          Control Send hDlg,hStatus, %WM_SETTEXT,0,VarPtr(zText)
          'SendMessage hStatus, %WM_SETTEXT, 0, VarPtr(zText)
          Function = 0
          Exit Function


    -------------
    Scott Turchin


    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      PS...

      These guys taught me about the BN_CLICKED piece, can't believe I never used it before:


      This is from the same DialogProc above, the code checks to see if the menu was clicked before it launches a new thread:

      Code:
          Case %WM_COMMAND
            Select Case LoWrd(wParam)
                   Case %IDM_ACHECK
                       Select Case CbCtlMsg
                           Case %BN_CLICKED
                              'Format should return such as this for Nuclear time clock, otherwise RFC etc..
                              '51468 99-10-17 05:12:27 15 0 0 888.6 UTC(NIST) *
                              If IsFalse g_lngInitThreadHandle Then
                                 Thread Create InitThread(id) To g_lngInitThreadHandle
                                 Thread Close g_lngInitThreadHandle To Result
                              End If
                              Function = 1
                              Exit Function
                       End Select
      -------------
      Scott Turchin


      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Control Send hDlg,hStatus, %WM_SETTEXT,0,VarPtr(zText)
        'SendMessage hStatus, %WM_SETTEXT, 0, VarPtr(zText)
        Scott, CONTROL SEND requires an ID for the control, not the handle of the control.


        -------------
        Lance
        PowerBASIC Support
        ( mailto:[email protected][email protected]</A> )
        Lance
        mailto:[email protected]

        Comment


        • #5
          Oops, I guess my question was less than clear. What I need is to know
          when the mouse is moved, pressed etc. Windows does not seem to pass
          this to the dialogproc the way it does to a window proc (or at least
          something is eating it along the way). I have since found I can get the
          messages by subclassing the DlgProc using SetWindowLong (%DWL_DLGPROC, ..)

          Comment

          Working...
          X