Jump to content
musicstashall

Messages to UpDown control

Recommended Posts

I was puzzled which message to send to the UpDown element in order to take a step to minus or plus. In the WM_NOTIFY construct, it turns out to do this, but I can’t understand how to construct the message directly.

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Local $tagNMUPDOWN = $tagNMHDR & ";int iPos;int iDelta"
    Local $tInfo = DllStructCreate($tagNMUPDOWN, $ilParam)
    
    $tInfo.iDelta = -1 ; step left
    $tInfo.iDelta = 1 ; step right
EndFunc

We need a way like this:

GUICtrlSendMsg($ctrl, $msg, $wParam, $lParam)

$lParam likely structure. $wParam not used

It turned out as follows, but only the left button responds (the element is horizontal, from Tab), some more parameters are needed.:

_SendMessage($hWnd, $WM_LBUTTONDOWN)

*********************************************

Empirically managed to do so:

Local $ptr_updown = 0
Local $aPos = ControlGetPos($GUI1, '', $hUpDown)
Local $tagNMUPDOWN = "int iPos;int iDelta"
Local $tInfo = DllStructCreate($tagNMUPDOWN)
If _WinAPI_GetMousePosX(True, $hUpDown) > $aPos[2] /2 Then 
    $ptr_updown = DllStructGetPtr($tInfo)
    $tInfo.iDelta = 1
EndIf
_SendMessage($hUpDown, $WM_LBUTTONDOWN, 0, $ptr_updown)

 

Edited by musicstashall

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...