Sl4yer Posted September 20, 2008 Share Posted September 20, 2008 why does nothing happen when the X(close button) on the right-top corner of the window $resWnd is clicked??? pls help cause i spent hours to figure it out expandcollapse popup$resWnd = GUICreate ("Suchergebnis", 400, $resWndSize, -1 , -1) $reslistView = GuiCtrlCreateListView("Dateiname |Pfad ", -1, -1, 350, 60) For $i = 1 to $aArray[0] $checkArrayCont = StringRegExp($aArray[$i], $dateisuche & "\\", 1, 0) If $checkArrayCont = 1 Then $pathStartPos = StringInStr ($aArray[$i], $dateisuche & "\", 0, -1) $pathEndPos = StringInStr ($aArray[$i], "\", 0, -1) $countPathChars = $pathEndPos - $pathStartPos Dim $extractPath = StringMid ($aArray[$i], $pathStartPos, $countPathChars) $ListViewItemcontrolID = GuiCtrlCreateListViewItem($aArray[$i] & "|" & $extractPath, $reslistView) EndIf Next GUISetState(@SW_SHOW, $resWnd) GUISwitch($resWnd) While 1 $msg2 = GUIGetMsg(1) If $msg2[0] = $GUI_EVENT_CLOSE AND $msg2[1] = $resWnd Then GuiDelete($resWnd) ExitLoop EndIf local $getCurSelection = _GUICtrlListViewGetCurSel($reslistView) If _GUICtrlListViewGetCurSel($reslistView) = 1 Then $curSelectedItemText = _GUICtrlListViewGetItemText($reslistView, _GUICtrlListViewGetSelectedIndices($reslistView), 1) If ($curSelectedItemText <> "") Then RunWait(@ComSpec & ' /c explorer "' & $curSelectedItemText & '\"', "", @SW_HIDE) EndIf _GUICtrlListViewSetItemSelState ($reslistView, _GUICtrlListViewGetSelectedIndices($reslistView), 0, 0) EndIf WEnd Link to comment Share on other sites More sharing options...
ChromeFan Posted September 20, 2008 Share Posted September 20, 2008 your code is not complete and also with bad order, Replace with this it works! While 1 $msg2 = GUIGetMsg() Switch $msg2 Case $GUI_EVENT_CLOSE GUIDelete($resWnd) ExitLoop EndSwitch WEnd Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
Sl4yer Posted September 20, 2008 Author Share Posted September 20, 2008 your code is not complete and also with bad order, Replace with this it works! While 1 $msg2 = GUIGetMsg() Switch $msg2 Case $GUI_EVENT_CLOSE GUIDelete($resWnd) ExitLoop EndSwitch WEnd hey Chrome, what do u mean with "my code is not complete" ?? I tried ur solution but it DOESNT work im about to go nuts >_< Link to comment Share on other sites More sharing options...
ChromeFan Posted September 20, 2008 Share Posted September 20, 2008 hey Chrome,what do u mean with "my code is not complete" ??I tried ur solution but it DOESNT work im about to go nuts >_<Your code is disordered, please correct it or tidy it. also post full code. where did you replace yours with mine? Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
ChromeFan Posted September 20, 2008 Share Posted September 20, 2008 (edited) don't use mine code in Function and place it under GUI Commands. just do something like this while creating GUI. #include <GUIConstants.au3> $F1 = GUICreate("Step1", 406, 450, 195, 114) $P1 = GUICtrlCreatePic("fff.jpg", 0, 0, 404, 404) $B1 = GUICtrlCreateButton("Yes", 48, 416, 75, 25, 0) $B2 = GUICtrlCreateButton("No", 248, 416, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Get = GUIGetMsg() Switch $Get Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Use "Case" instead of "If" it will enhance it's speed. Edited September 20, 2008 by ChromeFan Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
Sl4yer Posted September 20, 2008 Author Share Posted September 20, 2008 don't use mine code in Function and place it under GUI Commands. just do something like this while creating GUI. #include <GUIConstants.au3> $F1 = GUICreate("Step1", 406, 450, 195, 114) $P1 = GUICtrlCreatePic("fff.jpg", 0, 0, 404, 404) $B1 = GUICtrlCreateButton("Yes", 48, 416, 75, 25, 0) $B2 = GUICtrlCreateButton("No", 248, 416, 75, 25, 0) GUISetState(@SW_SHOW) While 1 $Get = GUIGetMsg() Switch $Get Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Use "Case" instead of "If" it will enhance it's speed. sry Chrome but i dont get it?? did u figure it out, the problem why the window $resWnd cant be closed??? ps: i know that switch is kinda faster than the if statement but thats not my problem... Link to comment Share on other sites More sharing options...
Bowmore Posted September 20, 2008 Share Posted September 20, 2008 Your problem is due to the fact that you are mixing OnEvent mode and Message mode together. When Opt("GUIOnEventMode", 1) is in force GUIGetMsg(1) will always return 0 and sets @error to 1. This quick fix will get your code working Func DButton() Opt("GUIOnEventMode", 0) ; Turn event mode off :Your function code goes here Opt("GUIOnEventMode", 1) ; Turn event mode back on EndFunc ;==>DButton "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
ChromeFan Posted September 20, 2008 Share Posted September 20, 2008 hmmm your problem is now solved, it will not kill you now Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now