2 Control in einer WM_Command behandeln

  • Halo und guten Abend,

    ich möchte die Ergebnisse von 2 Controls in einer WM_Command abfangen.
    Eine Listbox und einen Listview, Listbox funktioniert, Listview nicht!!!!

    Hier die Funktion:

    Spoiler anzeigen
    [autoit]


    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox, $hWndListView
    If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
    $hListView = $lV_Searchresults
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($lV_Searchresults)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word

    [/autoit]

    Switch $hWndFrom
    Case $hListBox, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
    _DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    $rc = _GUICtrlListBox_GetCount($hListBox)
    ;- _DebugPrint("Einträge: " & @TAB & $rc)
    $aglbitems = _GUICtrlListBox_GetCurSel($hListBox)
    ;- _DebugPrint("Ausgewählt: " & @TAB & $aglbitems)
    ; Get indexes of selected items
    $aItems = _GUICtrlListBox_GetText($hListBox, $aglbitems)
    ;- _DebugPrint("Items Selected: " & $aItems)
    If $aItems = 1 then
    $QueryStart = 1
    else
    $QueryStart = ($aItems - 1) * 50 + 1
    EndIf
    ;- ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $QueryStart = ' & $QueryStart & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $tmp = Stringreplace($YTQuery, "start-index=1", "start-index=" & $QueryStart)
    ;- ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $tmp = ' & $tmp & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    fnc_GetYTData($tmp)
    ; no return value
    Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request
    _DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus
    _DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box
    _DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed
    _DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    Return _ListDblClick()
    ; no return value
    Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus
    _DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    EndSwitch

    Case $hListView, $hWndListView
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hListView = ' & $hListView & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

    Switch $iCode
    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
    ; No return value

    EndSwitch
    EndSwitch
    ; Proceed the default Autoit3 internal message commands.
    ; You also can complete let the line out.
    ; !!! But only 'Return' (without any value) will not proceed
    ; the default Autoit3-message in the future !!!
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [autoit][/autoit]

    Weiß jemand warum nicht?

    MFG fschaef

    Einmal editiert, zuletzt von fschaef (3. August 2011 um 22:39)