Writing a DLL
- nblackburn
 - User

 - Posts: 67
 - Joined: Mon Aug 19, 2013 1:22 am
 - Location: United Kingdom
 - Contact:
 
Re: Writing a DLL
@chi
Is it possible to distinguish #WM_LBUTTONDBLCLK from #WM_LBUTTONDOWN in your hook?
My problem is that a left double click generates a sequence of four messages:
#WM_LBUTTONDOWN, #WM_LBUTTONUP, #WM_LBUTTONDBLCLK and #WM_LBUTTONUP
and something like this:
Would always trigger a "normal" left down press as well. Sure, this isn't wrong per se but in this
case a real left button down (pressed and hold) should be handled differently from a double click...
			
			
									
									
						Is it possible to distinguish #WM_LBUTTONDBLCLK from #WM_LBUTTONDOWN in your hook?
My problem is that a left double click generates a sequence of four messages:
#WM_LBUTTONDOWN, #WM_LBUTTONUP, #WM_LBUTTONDBLCLK and #WM_LBUTTONUP
and something like this:
Code: Select all
    Select wParam
      Case #WM_LBUTTONDBLCLK
        OutputDebugString_("Left double click detected!")
      Case #WM_MBUTTONDBLCLK
        OutputDebugString_("Middle double click detected!")
      Case #WM_XBUTTONDBLCLK
        ; We need to find out if X1 or X2 button was used!
        ; https://docs.microsoft.com/en-us/windows/desktop/inputdev/wm-xbuttondblclk
        OutputDebugString_("X double click detected!")
      ; Press and hold cases
      Case #WM_LBUTTONDOWN
        OutputDebugString_("Left DOWN click detected!")
    EndSelect
case a real left button down (pressed and hold) should be handled differently from a double click...
Re: Writing a DLL
Don't know if this suits your needs, but you could do something like this...oO0XX0Oo wrote:Is it possible to distinguish #WM_LBUTTONDBLCLK from #WM_LBUTTONDOWN in your hook?
Code: Select all
Enumeration
  #NLH_DLL_CONTROL = #WM_USER + 101
EndEnumeration
Procedure TimerProc(hwnd, uMsg, idEvent, dwTime)
  KillTimer_(hwnd, idEvent)
  OutputDebugString_("Left DOWN click detected!")
EndProcedure
ProcedureDLL NLH( nCode, wParam, *lParam.MOUSEHOOKSTRUCT )
  
  If nCode < 0 : ProcedureReturn CallNextHookEx_( @NLH(), nCode, wParam, *lParam ) : EndIf
  
  Select wParam
      
    Case #WM_LBUTTONDOWN
      SetTimer_(*lParam\hwnd, 1, GetDoubleClickTime_(), @TimerProc())
      
    Case #WM_LBUTTONDBLCLK
      KillTimer_(*lParam\hwnd, 1)
      OutputDebugString_("Left double click detected!")
      
  EndSelect
  
  ProcedureReturn CallNextHookEx_( @NLH(), nCode, wParam, *lParam )
  
EndProcedureEt cetera is my worst enemy
						Re: Writing a DLL
I'm linking this here in case you have any crashes related to making a global hook DLL with PureBasic:
viewtopic.php?f=4&t=61027
I haven't tested this recently so I don't know if it's become more stable since my original report.
			
			
									
									
						viewtopic.php?f=4&t=61027
I haven't tested this recently so I don't know if it's become more stable since my original report.
Re: Writing a DLL
I've never experienced such crashes with my DLLMistrel wrote:I'm linking this here in case you have any crashes related to making a global hook DLL with PureBasic
Et cetera is my worst enemy
						
