Announcement

Collapse
No announcement yet.

Mouse messages in a Dialog

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

  • James GrahamEagle
    Guest replied
    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, ..)

    Leave a comment:


  • Lance Edmonds
    replied
    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> )

    Leave a comment:


  • Scott Turchin
    replied
    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


    Leave a comment:


  • Scott Turchin
    replied
    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


    Leave a comment:


  • James GrahamEagle
    Guest started a topic Mouse messages in a Dialog

    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.
Working...
X