Jump to content
Sign in to follow this  

WM_Notify for two controls

Recommended Posts



I have discovered something "strange" (for me)

while using (registering) a wm_notify function for

two controls.


In my exemple it was for a rich text box and (then) a toolbar in

another (child) window.

When I put within the "switch hWndFrom" first the "case" of

a toolbar and then the "case" for the RTB, the RTB doesn't send

any message. In reversed order : first the "case" of the TRB and then

the "case" of the toolbar, both of them send messages.

So my solution was only to "reorder" the "case's" within the

"switch hWndFrom" and that's it.

Used with 3.2.10.

an exemple of illustration (now correct!!!):

Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
        Case $RichEdit
            Switch $code
                Case $EN_SELCHANGE
                    Local $tSELCHANGE = DllStructCreate($tagSELCHANGE, $lParam)
                    Local $cpMin = DllStructGetData($tSELCHANGE, 4)
                    Local $cpMax = DllStructGetData($tSELCHANGE, 5)
                    ConsoleWrite("Sel change:" & @LF & $cpMin & " --- " & $cpMax & @LF)
        Case $Typo_Toolbar, $Typo_Toolbar2
            Switch $code
                Case $NM_LDOWN
                    $What_TB = $hWndFrom
                    ConsoleWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($What_TB, $iItem) & @CRLF)
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $iItem = $i_idNew
                    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")


Maybe it has to be like this.

Edited by grham

Share this post

Link to post
Share on other sites

Read helpfile about Switch...Case...EndSwitch syntax.

"be smart, drink your wine"

Share this post

Link to post
Share on other sites

What Siao is saying is:

Case $Typo_Toolbar Or $Typo_Toolbar2oÝ÷ ÚÈhºW[y«­¢+Ø

Because you used Switch

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


Share this post

Link to post
Share on other sites


I get it now. It was only a coincidence that it worked

with "OR". When I put a coma, this behavior disapears.

Thanks Siao and Gary

And sorry (my fault)

Edited by grham

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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.