Hallo,
nun habe ich schon so oft das WMNotify benutzt und zum laufen bekommen,
aber in diesem Script geht es nicht.
Das WMNotify soll (wie nur unschwer zu sehen) auf Doppelclick im ListView reagieren.
Irgendwo ist ein Fehler.
Kann mir jemand sagen wo er steckt?
Note: Es passiert quasi gar nix bei Doppelclick...
Danke vorab
Spoiler anzeigen
#include <Constants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiHeader.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <ProgressConstants.au3>
#include <ListviewConstants.au3>
#include <GuiComboBox.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <string.au3>
#include <StaticConstants.au3>
#include <includeMy\mssql.au3>
#include <string.au3>
Global $var1, $ListeWE
[/autoit] [autoit][/autoit] [autoit]Opt("GUICoordMode", 1)
$WEKomi = GUICreate ("WEKomi - Kommissionierung Wareneingang",1366,700,1,1) ; start the definition
GUISetBkColor(0xA6CAF0)
GUISetIcon(@ScriptDir & "\media\favicon.ico")
GUICtrlCreateGroup("", 20, 1,1335, 58)
$Pic2 = GUICtrlCreatePic(@ScriptDir & "\media\LOGO1.gif", 800, 10, 156, 47)
$Bestellnummer = GUICtrlCreateInput("XXXXX", 500, 10, 80, 34)
GUICtrlSetFont(-1, 16, 400, 0, "Calibri")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$hListeWE = _GUICtrlListView_Create($WEKomi,"", 10, 108, 1335,600)
_GUICtrlListView_SetExtendedListViewStyle ($hListeWE, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER, $LVS_EX_TWOCLICKACTIVATE,$LVS_EX_MULTIWORKAREAS))
GUISetState()
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
[/autoit] [autoit][/autoit] [autoit]_GUICtrlListView_InsertColumn($hListeWE, 0, "BestellNr",90)
_GUICtrlListView_InsertColumn($hListeWE, 1, "Pos",50)
_GUICtrlListView_InsertColumn($hListeWE, 2, "Artikel Nr",90)
_GUICtrlListView_InsertColumn($hListeWE, 3, "Bezeichnung Position",260)
_GUICtrlListView_InsertColumn($hListeWE, 4, "Bauteilnummer",200)
_GUICtrlListView_InsertColumn($hListeWE, 5, "Stüli Position",220)
_GUICtrlListView_InsertColumn($hListeWE, 6, "bestellt",100)
_GUICtrlListView_InsertColumn($hListeWE, 7, "geliefert",100)
_GUICtrlListView_InsertColumn($hListeWE, 8, "Länge",70)
_GUICtrlListView_InsertColumn($hListeWE, 9, "Breite",70)
_GUICtrlListView_InsertColumn($hListeWE, 10,"Höhe",70)
GUISetState ()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")
While 1
$Msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Bestellnummer
If StringLen(GUICtrlRead($Bestellnummer))> 5 or StringLen(GUICtrlRead($Bestellnummer))< 5 Then
MsgBox(5,"Achtung", "Die Bestellnummer ist nicht korrekt!")
ElseIf StringLen(GUICtrlRead($Bestellnummer))= 5 Then
Kontrolle()
if $var1 == Null Then
MsgBox(0, "Achtung", "Diese Eingegebene Bestellnummer gibt es im Beosys nicht!")
Else
Wareneingangsliste()
EndIf
EndIf
EndSelect
Wend
func Kontrolle()
$sql = _SQLCon("Server", "Datenbank")
$var1 = _SQLQuery($sql, "SELECT BST_Nummer" & _
" FROM Bestellung" & _
" WHERE (BST_Nummer = " & GUICtrlRead($Bestellnummer) & ")")
EndFunc
[/autoit] [autoit][/autoit] [autoit]func Wareneingangsliste()
_GUICtrlListView_DeleteAllItems($hListeWE)
$sql = _SQLCon("Server", "Datenbank")
$var1 = _SQLQuery($sql, "SELECT Bestellung.BST_Nummer, BestellungPosition.BSP_Position, Artikel.ART_Nummer, BestellungPosition.BSP_Nummer, BestellungPosition.BSP_Bezeichnung, BestellungPosition.BSP_ZeichnungsNummer, " & _ ;
" Struktur.STR_PositionGesamt, BestellungPosition.BSP_MengeBestellt, BestellungPosition.BSP_MengeGeliefert, BestellungPosition.BSP_Laenge, BestellungPosition.BSP_Breite, BestellungPosition.BSP_Hoehe " & _
" FROM BestellungPosition INNER JOIN" & _
" Bestellung ON BestellungPosition.BSP_BestellungID = Bestellung.BST_BestellungID LEFT OUTER JOIN" & _
" Artikel ON BestellungPosition.BSP_ArtikelID = Artikel.ART_ArtikelID LEFT OUTER JOIN" & _
" Struktur INNER JOIN" & _
" BestellungAuftrag ON Struktur.STR_StrukturID = BestellungAuftrag.BAZ_StrukturID ON BestellungPosition.BSP_BestellungPositionID = BestellungAuftrag.BAZ_BestellungPositionID" & _
" WHERE (Bestellung.BST_Nummer = " & GUICtrlRead($Bestellnummer) & ")")
Dim $iLV1 = 0 ; Zähler i für ListView1
with $var1
While not .EOF
;~ MsgBox(1,"Test", "Test")
_GUICtrlListView_ADDItem($hListeWE,.Fields("BST_Nummer").value,0)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_Position").value,1)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("ART_Nummer").value,2)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_Bezeichnung").value,3)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_ZeichnungsNummer").value,4)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("STR_PositionGesamt").value,5)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_MengeBestellt").value,6)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_MengeGeliefert").value,7)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_Laenge").value,8)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_Breite").value,9)
_GUICtrlListView_AddSubItem($hListeWE,$iLV1,.Fields("BSP_Hoehe").value,10)
$iLV1 += 1
.Movenext
WEnd
EndWith
_SQLEnd($sql)
EndFunc
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
;~ #forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
;~ ConsoleWrite($hWnd & @TAB & $iMsg & @TAB & $iwParam & @TAB & $ilParam & @TAB & $iIDFrom & @CRLF)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $ListeWE
MsgBox(16, "Error", $hListeWE)
Switch $iCode
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
MsgBox(16, "Error", "Es wurde kein Datensatz markiert!")
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
Local $aInfo[12] = [$hWndFrom, _
$iIDFrom, _
$iCode, _
DllStructGetData($tInfo, "Index"), _
DllStructGetData($tInfo, "SubItem"), _
DllStructGetData($tInfo, "NewState"), _
DllStructGetData($tInfo, "OldState"), _
DllStructGetData($tInfo, "Changed"), _
DllStructGetData($tInfo, "ActionX"), _
DllStructGetData($tInfo, "ActionY"), _
DllStructGetData($tInfo, "lParam"), _
DllStructGetData($tInfo, "KeyFlags")]
_LeftDblClickListe($aInfo)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_NOTIFY
Func _LeftDblClickListe($aInfo)
$300links = StringLeft(_GUICtrlListView_GetItemTextString($hListeWE), 400)
$result = StringInStr($300links, "SN")
$result = $result - 1
Global $SNNummer = StringLeft($300links, $result)
If $SNNummer == 0 Then
MsgBox(16, "Error", "Es wurde kein Datensatz markiert!")
Elseif $SNNummer <> 0 Then
MsgBox(16, "Error", $SNNummer)
;~ ClipPut ($lfdNR_TGNListe)
;~ RunWait(@scriptdir & "\TGN\TGNBearbeiten.exe")
;~ TelefonGespraechsListe()
EndIf
EndFunc