Hallo Alle,
kann man in einer Listbox auf die ENTER-Taste reagieren? Wahrscheinlich über das registrieren einer WM_Command, aber wie geht das genau?
Danke!
Hallo Alle,
kann man in einer Listbox auf die ENTER-Taste reagieren? Wahrscheinlich über das registrieren einer WM_Command, aber wie geht das genau?
Danke!
guck dir mal den befehl
[autoit]_IsPressed()
[/autoit]
an, ich glaube das ist das, was du suchst
mfg
hauke
guck dir mal den befehl
[autoit]_IsPressed()
[/autoit]
an, ich glaube das ist das, was du suchstmfg
hauke
Und wie komme ich dabei an das gerade aktive Control?
poste bitte dein script, dann kann ich dir bestimmt besser helfen.
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Constants.au3>
Global Const $VK_RETURN = 0x0D
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("", 200, 200)
$hListView = _GUICtrlListView_Create($hGUI, "Spalte 1", 10, 10)
For $i = 1 To 10
_GUICtrlListView_AddItem($hListView, Random(1,1000,1))
Next
GUISetState(@SW_SHOW)
$wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
$wProcOld = _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))
While 1
$msg = GUIGetMsg()
Switch $msg
case $GUI_EVENT_CLOSE
_WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, $wProcOld)
DllCallbackFree($wProcHandle)
Exit
EndSwitch
Wend
Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
Switch $hWnd
Case $hListView
Switch $Msg
Case $WM_GETDLGCODE
Switch $wParam
Case $VK_RETURN
MsgBox(0,0, _GUICtrlListView_GetItemText($hListview,_GUICtrlListView_GetSelectedIndices($hListview)))
Return 0
EndSwitch
EndSwitch
EndSwitch
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
EndFunc
Das würde mich auch interessieren.
Aber generell auch für Inputfelder, Editfelder, etc...
Es gibt da noch die Funktion HotKeySet, aber die prüft den Tastendruck auch nicht im aktiven Control.
Alles anzeigenSpoiler anzeigen
[autoit]#include
[/autoit] [autoit][/autoit] [autoit]
#include
#include
#includeGlobal Const $VK_RETURN = 0x0D
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("", 200, 200)
[/autoit] [autoit][/autoit] [autoit]
$hListView = _GUICtrlListView_Create($hGUI, "Spalte 1", 10, 10)
For $i = 1 To 10
_GUICtrlListView_AddItem($hListView, Random(1,1000,1))
Next
GUISetState(@SW_SHOW)$wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
[/autoit] [autoit][/autoit] [autoit]
$wProcOld = _WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))While 1
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()
Switch $msg
case $GUI_EVENT_CLOSE
_WinAPI_SetWindowLong($hListView, $GWL_WNDPROC, $wProcOld)
DllCallbackFree($wProcHandle)
Exit
EndSwitch
WendFunc _WindowProc($hWnd, $Msg, $wParam, $lParam)
[/autoit]
Switch $hWnd
Case $hListView
Switch $Msg
Case $WM_GETDLGCODE
Switch $wParam
Case $VK_RETURN
MsgBox(0,0, _GUICtrlListView_GetItemText($hListview,_GUICtrlListView_GetSelectedIndices($hListview)))
Return 0
EndSwitch
EndSwitch
EndSwitch
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
EndFunc
Danke, funktioniert soweit.
poste bitte dein script, dann kann ich dir bestimmt besser helfen.
In Kürze, was das Script bis jetzt tut:
Auruf der Youtube Search Api
Holen Liste aller Videos für einen Nicknamen/Schlagwort
Ein/Auslesen der Daten in eine temp. Datei
Datei in Listview
Listbox will ich zum auswählen der einzelnen Reportseiten verwenden.
Danke im voraus. Code ist z. T. unübersichtlich, ich weiß das selbst
#include <file.au3>
#include <array.au3>
#include <string.au3>
#Include <GuiListView.au3>
#include <GuiStatusBar.au3>
#Include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiEdit.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <GDIPlus.au3>
#include "_GUIImageList_AddBitmapEx.au3"
#Include <Misc.au3>
#Region ### START Koda GUI section ### Form=
[/autoit] [autoit][/autoit] [autoit]Local $aParts[3] = [250, 550, -1]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$Form1 = GUICreate("Youtube Video Suche", 733, 547, 192, 124)
$hStatus = _GUICtrlStatusBar_Create ($Form1, $aParts)
$rc = ping("www.youtube.de")
If $rc = 0 Then
$lb_MsgText1 = GUICtrlCreateLabel("Keine aktive Internetverbindung vorhanden!", 40, 124, 540, 100)
GUICtrlSetFont(-1, 22, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
Else
$lV_Searchresults = GUICtrlCreateListView("", 40, 72, 661, 450)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000A0)
GUICtrlSetBkColor(-1, 0xBBCCEE)
$ListView1context = GUICtrlCreateContextMenu($lV_Searchresults)
$MenuItem1 = GUICtrlCreateMenuItem("Del", $ListView1context)
; Add columns
;_GUICtrlListView_AddColumn($lV_Searchresults, "", 25)
_GUICtrlListView_AddColumn($lV_Searchresults, "Nr", 95, 1)
_GUICtrlListView_AddColumn($lV_Searchresults, "Titel", 200)
_GUICtrlListView_AddColumn($lV_Searchresults, "Dauer", 50, 1)
_GUICtrlListView_AddColumn($lV_Searchresults, "Schlüsselwörter", 350)
_GUICtrlListView_AddColumn($lV_Searchresults, "YTID", 0)
; Create an image list with images
$hImage = _GUIImageList_Create(65, 55, 5, 1)
_GUIImageList_AddBitmapEx($hImage, @ScriptDir & "\Icons\default.jpg")
_GUICtrlListView_SetImageList($lV_Searchresults, $hImage, 1)
EndIf
$lb_Author = GUICtrlCreateLabel("Name/Nickname des Authors", 40, 24, 140, 17)
$ef_Author = GUICtrlCreateInput("7600Celsius", 40, 45, 140, 20)
$lb_Keyword = GUICtrlCreateLabel("Schlüsselwort", 185, 24, 140, 17)
$ef_Keyword = GUICtrlCreateInput("", 185, 45, 140, 20)
$btn = GUICtrlCreateButton("Suche starten", 330, 45, 90, 20)
[/autoit] [autoit][/autoit] [autoit]$lb_MsgText = GUICtrlCreateLabel("Hole Seite 1", 572, 24, 60, 17)
GUICtrlSetState($lb_MsgText, $GUI_HIDE)
$hListBox = GUICtrlCreateList("", 658, 22, 40, 55)
GUICtrlSetState($hListBox, $GUI_HIDE)
ControlSend($Form1, "", $ef_Author, "{END}")
ControlFocus($Form1, "", $ef_Author)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $aRecords, $lV_Searchresults_values[50][7]
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn
if ControlGetText($Form1, "", $ef_Author) = "" AND _
ControlGetText($Form1, "", $ef_Keyword) = "" then
MsgBox(64, "Youtube Video Suche - Fehler", "Suchkriterium fehlt: " & @CRLF & @CRLF & _
"Entweder Nickname oder 1 Schlüsselwort" & @CRLF & "muß vorhanden sein")
ControlFocus($Form1, "", $ef_Author)
ContinueCase
ElseIf ControlGetText($Form1, "", $ef_Author) <> "" AND _
ControlGetText($Form1, "", $ef_Keyword) <> "" then
$YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=" & ControlGetText($Form1, "", $ef_Keyword)& "&author=" & ControlGetText($Form1, "", $ef_Author)
ElseIf ControlGetText($Form1, "", $ef_Author) <> "" Then
$YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&author=" & ControlGetText($Form1, "", $ef_Author)
Else
$YTQuery = "http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=" & ControlGetText($Form1, "", $ef_Keyword)
endif
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $YTQuery = ' & $YTQuery & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
GUICtrlSetState($hListBox, BitOR($GUI_enable, $GUI_HIDE))
GUICtrlSetState($lb_MsgText, BitOR($GUI_enable, $GUI_HIDE))
GUICtrlSetState($btn, $GUI_disable)
ControlSetText($Form1, "", $btn, "Hole Daten ...")
; MsgBox(64, "Info", "Autkor: " & ControlGetText($Form1, "", $ef_Author))
;Sleep(5000)
fnc_GetYTData($YTQuery)
ControlSetText($Form1, "", $btn, "Suche")
GUICtrlSetState($btn, $GUI_enable)
GUICtrlSetState($hListBox, BitOR($GUI_enable, $GUI_SHOW))
GUICtrlSetState($lb_MsgText, BitOR($GUI_enable, $GUI_SHOW))
case $hListBox
if _IsPressed("0D") then ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Enter in Listbox')
EndSwitch
WEnd
GUIDelete($Form1)
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
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)
; 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
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
Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint
Func _ListDblClick()
Local $indx = _GUICtrlListBox_GetCurSel($hListBox)
ControlSetText($Form1, "", $lb_MsgText, "Hole Seite " & _GUICtrlListBox_GetText($hListBox, $indx))
EndFunc
Func fnc_GetYTData($SearchArg)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$rc = FileDelete(@ScriptDir & "\update.dat")
_GUICtrlStatusBar_SetText ($hStatus, "Hole Kataloginformationen", 1)
; Local $hDownload = InetGet("http://gdata.youtube.com/feeds/api/users/7600celsius/uploads?max-results=50&start-index=1&lr=de", @ScriptDir & "\update.dat", 1, 1)
; Local $hDownload = InetGet("http://gdata.youtube.com/feeds/api/videos?max-results=50&start-index=1&q=relax&author=7600CELSIUS", @ScriptDir & "\update.dat", 1, 1)
Local $hDownload = InetGet($SearchArg, @ScriptDir & "\update.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resourcs.
;MsgBox(0, "", "Bytes read: " & $nBytes)
_GUICtrlStatusBar_SetText ($hStatus, "Bereite auf ...", 1)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$rcfo = FileOpen(@ScriptDir & "\update.dat")
$fileline = FileReadLine($rcfo, 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $fileline = ' & $fileline & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$newchars = StringReplace($fileline, "><", ">|<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $chars = ' & $newchars & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$rc = FileClose($rcfo)
_GUICtrlStatusBar_SetText ($hStatus, "Lade...", 1)
$aRecords = StringSplit($newchars, "|")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aRecords = ' & UBound($aRecords) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$chars = ""
$newchars = ""
_GUICtrlListView_BeginUpdate(GUICtrlGetHandle($lV_Searchresults))
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($lV_Searchresults))
_GUICtrlListView_EndUpdate(GUICtrlGetHandle($lV_Searchresults))
Local $astartiResult = _ArrayFindAll($aRecords, "<entry", 0, 0, 0, 1)
[/autoit] [autoit][/autoit] [autoit];_ArrayDisplay($astartiResult, "Results of searching for 0 in $avArray")
[/autoit] [autoit][/autoit] [autoit]Local $aendiResult = _ArrayFindAll($aRecords, "</entry", 0, 0, 0, 1)
[/autoit] [autoit][/autoit] [autoit];_ArrayDisplay($aendiResult, "Results of searching for 0 in $avArray")
if UBound($astartiResult) > UBound($aendiResult) then Exit
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : UBound($aendiResult) = ' & UBound($aendiResult) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : UBound($astartiResult) = ' & UBound($astartiResult) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
for $lv = 0 to UBound($astartiResult) - 1
if StringInStr($aRecords[$lv],"<openSearch:totalResults>") > 0 Then
$dataArea = StringReplace($aRecords[$lv],">",">|")
$dataArea = StringReplace($dataArea,"<","|<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Katinfo gefunden ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = StringSplit($dataArea,"|")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Anzahl Einträge ' & $dataArea[3] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$AnzSeiten = Int($dataArea[3] / 50)
;_GUICtrlStatusBar_SetText ($hStatus, "Anzahl Seiten: " & $AnzSeiten & ", Aktuelle Seite: " & $dataArea[2], 0)
EndIf
[/autoit] [autoit][/autoit] [autoit]if StringInStr($aRecords[$lv],"<openSearch:startIndex>") > 0 Then
$dataArea = StringReplace($aRecords[$lv],">",">|")
$dataArea = StringReplace($dataArea,"<","|<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Katinfo gefunden ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = StringSplit($dataArea,"|")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Anzahl Einträge ' & $dataArea[3] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$AktSeite = Int($dataArea[3] / 50)
if $AktSeite < 1 then $AktSeite = 1
_GUICtrlStatusBar_SetText ($hStatus, "Anzahl Seiten: " & $AnzSeiten & ", Aktuelle Seite: " & $AktSeite, 0)
EndIf
;ConsoleWrite('@@ Debug ' & $lv &' =========================================================' & @CRLF)
for $mediagroup = $astartiResult[$lv] + 1 to $aendiResult[$lv] - 1
; ConsoleWrite('@@ Debug ' & $aRecords[$mediagroup] & @CRLF)
if StringInStr($aRecords[$mediagroup],"<media:keywords>") > 0 Then
$dataArea = StringStripWS($aRecords[$mediagroup], 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = _StringBetween($dataArea,">","<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$lV_Searchresults_values[$lv][0] = $dataArea[0]
EndIf
[/autoit] [autoit][/autoit] [autoit]if StringInStr($aRecords[$mediagroup],"<id>") > 0 Then
$dataArea = StringStripWS($aRecords[$mediagroup], 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = _StringBetween($dataArea,">","<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$lV_Searchresults_values[$lv][1] = StringReplace($dataArea[0], "http://gdata.youtube.com/feeds/api/videos/", "")
EndIf
[/autoit] [autoit][/autoit] [autoit]if StringInStr($aRecords[$mediagroup],"<media:title") > 0 Then
$dataArea = StringStripWS($aRecords[$mediagroup], 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = _StringBetween($dataArea,">","<")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$lV_Searchresults_values[$lv][2] = $dataArea[0]
EndIf
[/autoit] [autoit][/autoit] [autoit]if StringInStr($aRecords[$mediagroup],"<published>") > 0 Then
$dataArea = StringStripWS($aRecords[$mediagroup], 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = _StringBetween($dataArea,">","<")
$dataArea = _StringBetween($dataArea[0], "", "T")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = StringSplit($dataArea[0], "-")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & UBound($dataArea) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$lV_Searchresults_values[$lv][3] = $dataArea[3] & "." & $dataArea[2] & "." & $dataArea[1]
EndIf
[/autoit] [autoit][/autoit] [autoit]if StringInStr($aRecords[$mediagroup],"<yt:duration") > 0 Then
$dataArea = StringStripWS($aRecords[$mediagroup], 1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$dataArea = _StringBetween($dataArea,"'","'")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $dataArea = ' & $dataArea[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$tempvalue = _Stringbetween($aRecords[$mediagroup], ">", "<", -1)
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') $lv : $tempvalue = ' & $lv & "-" & $tempvalue & "-" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$tempMinuten = Int($dataArea[0] / 60)
$lV_Searchresults_values[$lv][4] = Int($dataArea[0] / 60) & ":" & StringFormat("%02d",$dataArea[0] - ($tempMinuten * 60))
$lV_Searchresults_values[$lv][5] = $dataArea[0]
$lV_Searchresults_values[$lv][6] = $dataArea[0] * 192 * 1000 ;/ (1024 * 1024 * ![]()
EndIf
Next
$NewItem = _GUICtrlListView_AddItem($lV_Searchresults, $lv+1)
_GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][2], 1, 1)
_GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][4], 2, 1)
_GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][0], 3, 1)
_GUICtrlListView_AddSubItem($lV_Searchresults, $NewItem, $lV_Searchresults_values[$lv][1], 4, 1)
Next
; _ArrayDisplay($lV_Searchresults_values, "Results of searching for 0 in $avArray")
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $lV_Searchresults_values) = ' & UBound($lV_Searchresults_values) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
for $i = 0 to _GUICtrlListBox_GetCount(GUICtrlGetHandle($hListBox)) + 1
_GUICtrlListBox_DeleteString(GUICtrlGetHandle($hListBox), $i)
Next
for $i = 1 to $AnzSeiten
_GUICtrlListBox_AddString(GUICtrlGetHandle($hListBox), $i)
Next
_GUICtrlListBox_SetCurSel(GUICtrlGetHandle($hListBox), 0)
_GUICtrlStatusBar_SetText ($hStatus, "Fertig", 1)
GUICtrlSetState($lb_MsgText, $GUI_SHOW)
GUICtrlsetState(GUICtrlGetHandle($hListBox), $GUI_SHOW)
ControlFocus($Form1, "", GUICtrlGetHandle($hListBox))
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : GUICtrlgetState($hListBox, $GUI_SHOW) = ' & GUICtrlgetState($hListBox) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
EndFunc
Das würde mich auch interessieren.
Aber generell auch für Inputfelder, Editfelder, etc...
Es gibt da noch die Funktion HotKeySet, aber die prüft den Tastendruck auch nicht im aktiven Control.
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Constants.au3>
Global Const $VK_RETURN = 0x0D
[/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("", 200, 200)
$input =GUICtrlCreateInput("bla",5,5)
$hInput = GUICtrlGetHandle($input)
GUISetState(@SW_SHOW)
$wProcHandle = DllCallbackRegister("_WindowProc", "int", "hwnd;uint;wparam;lparam")
$wProcOld = _WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))
While 1
$msg = GUIGetMsg()
Switch $msg
case $GUI_EVENT_CLOSE
_WinAPI_SetWindowLong($hInput, $GWL_WNDPROC, $wProcOld)
DllCallbackFree($wProcHandle)
Exit
EndSwitch
Wend
Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
Switch $hWnd
Case $hInput
Switch $Msg
Case $WM_GETDLGCODE
Switch $wParam
Case $VK_RETURN
MsgBox(0,0, GUICtrlRead($input))
Return 0
EndSwitch
EndSwitch
EndSwitch
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $Msg, $wParam, $lParam)
EndFunc