Noobster24 Posted August 28, 2006 Share Posted August 28, 2006 (edited) Hi, this is one of my functions to create a 2nd GUI Window where some text is put into a editbox: Func _Checka($x) $ret2 = _GUICtrlListViewGetItemText ($listview, -1, 0) If Not ($x <> $LV_ERR) Then MsgBox(16,'Niets geselecteerd','Je moet wel eerst wat selecteren xD!') GUICtrlSetState($zoek,$GUI_DISABLE) GUICtrlSetState($clear,$GUI_DISABLE) GUICtrlSetState($afsluiten,$GUI_DISABLE) GUICtrlSetState($about,$GUI_DISABLE) GuiCtrlSetState($Btn_GetSelected, $GUI_DISABLE) $win_3 = GUICreate('Ser van ' & $ret2 & ' ID: ' & $x, 500, 230) $copy = GUICtrlCreateButton ('Kopieër registratieinformatie naar clipboard', 50, 10, 400) $sourceserial = _INetGetSource ("http://website.com/d.php?n=" & $x) $filecr = _FileCreate($serial) If @error = 1 OR @error = 2 Then Msgbox(16,'Kan bestand niet aanmaken!','Foutcode #1') Exit EndIf $file2 = FileOpen($serial, 2) If $file2 = -1 Then Msgbox(16,'Kan bestand niet openen!','Foutcode #2') Exit EndIf If Not FileWrite($file2, $sourceserial) Then Msgbox(16,'Kan bestand niet beschrijven!','Foutcode #3') Exit EndIf If Not FileClose($file2) Then Msgbox(16,'Kan bestand niet afsluiten!','Foutcode #4') Exit EndIf $serials = _SRE_Between(@ScriptDir & '\Files\file.txt', '<TEXTAREA rows=4 cols=50', '</TEXTAREA>') $serials2 = _SRE_Between(@ScriptDir & '\Files\file.txt', '<TEXTAREA rows=4 cols=50', '</textarea>') $serials3 = _SRE_Between(@ScriptDir & '\Files\file.txt', '<textarea rows=4 cols=50', '</TEXTAREA>') $myedit = GUICtrlCreateEdit ('', 20,62,455,140) If IsArray($serials) Then For $i = 0 To UBound($serials) - 1 If StringInStr($serials[$i], "wrap>") Then $edit = StringReplace($serials[$i], "wrap>", "") $edit2 = StringStripWS ($edit, 3) Else $edit = StringReplace($serials[$i], ">", "") $edit2 = StringStripWS ($edit, 3) EndIf GUICtrlSetData ($myedit, $edit2) Next ElseIf IsArray($serials2) Then For $i = 0 To UBound($serials2) - 1 If StringInStr($serials2[$i], "wrap>") Then $edit = StringReplace($serials2[$i], "wrap>", "") $edit2 = StringStripWS ($edit, 3) Else $edit = StringReplace($serials2[$i], ">", "") $edit2 = StringStripWS ($edit, 3) EndIf GUICtrlSetData ($myedit, $edit2) Next ElseIf IsArray($serials3) Then For $i = 0 To UBound($serials3) - 1 If StringInStr($serials3[$i], "wrap>") Then $edit = StringReplace($serials3[$i], "wrap>", "") $edit2 = StringStripWS ($edit, 3) Else $edit = StringReplace($serials3[$i], ">", "") $edit2 = StringStripWS ($edit, 3) EndIf GUICtrlSetData ($myedit, $edit2) Next Else MsgBox(0,'Limiet','Je hebt al 10 aangevraagd vandaag xD!') EndIf GUICtrlSetState($zoek,$GUI_ENABLE) GUICtrlSetState($clear,$GUI_ENABLE) GUICtrlSetState($afsluiten,$GUI_ENABLE) GUICtrlSetState($about,$GUI_ENABLE) GuiCtrlSetState($Btn_GetSelected, $GUI_ENABLE) GUISetState () While 1 $333 = GUIGetMsg() Switch $333 Case $GUI_EVENT_CLOSE ExitLoop Case $copy MsgBox(0,'Hey!','Hey JHN?!') EndSwitch WEnd EndFuncWell this is the idea, someone fills a inputbox with a keyword, it searches a website, gets the source of the website & the source is written into a txt-file. It opens the txt-file and checks for a code. The code is written into the editbox. Well that works... But when i add this code, it doesn't work anymore and the program hangs, without that code the gui is shown, the editbox is filled & the button is shown. But without this code you can't figer out what to do if the button $copy is pressed: While 1 $333 = GUIGetMsg() Switch $333 Case $GUI_EVENT_CLOSE ExitLoop Case $copy MsgBox(0,'Hey!','Hey JHN?!') EndSwitch WEnd (This is the code that my program hangs...) Anyone got ideas how to fix it? Edited August 28, 2006 by Noobster24 Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc. Link to comment Share on other sites More sharing options...
Valuater Posted August 28, 2006 Share Posted August 28, 2006 I cant get the exact answer, however it appears thet $win_3 is a child gui ( just guessing)$win_3 = GUICreate('Ser van ' & $ret2 & ' ID: ' & $x, 500, 230)... maybe take a look at...GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] parent [optional] The handle of another previously created window - this new window then becomes a child of that window.and then maybe you could try setting the state of this gui before all the other control set states and ect...$win_3 = GUICreate('Ser van ' & $ret2 & ' ID: ' & $x, 500, 230) $copy = GUICtrlCreateButton ('Kopieër registratieinformatie naar clipboard', 50, 10, 400) $myedit = GUICtrlCreateEdit ('', 20,62,455,140) GUISetState ()8) Link to comment Share on other sites More sharing options...
Noobster24 Posted August 28, 2006 Author Share Posted August 28, 2006 (edited) I cant get the exact answer, however it appears thet $win_3 is a child gui ( just guessing) $win_3 = GUICreate('Ser van ' & $ret2 & ' ID: ' & $x, 500, 230)... maybe take a look at... GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] parent [optional] The handle of another previously created window - this new window then becomes a child of that window. and then maybe you could try setting the state of this gui before all the other control set states and ect... $win_3 = GUICreate('Ser van ' & $ret2 & ' ID: ' & $x, 500, 230) $copy = GUICtrlCreateButton ('Kopieër registratieinformatie naar clipboard', 50, 10, 400) $myedit = GUICtrlCreateEdit ('', 20,62,455,140) GUISetState () 8) Hmmz, i'm checking it out now, but i can't figger it out :S, i try to create a while loop with $msg3 = GUIGetMsg() Just like this one (main window): GuiSetState() TraySetState() While 1 $msg = GuiGetMsg() $msg1 = TrayGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $exititem, $afsluiten, $exitcontext ExitLoop Case $about, $infoitem, $aboutcontext _AboutBox() Case $zoek _Check($sq) Case $Btn_GetSelected $ret = _GUICtrlListViewGetItemText ($listview, -1, 1) _Checka($ret) Case $cmd Run(@ComSpec) Case $notepad Run('notepad.exe') Case $ie Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE') Case $regedit Run('regedit.exe') Case $clear, $clearcontext _Clear() Case $minimize, $minicontext GUISetState(@SW_MINIMIZE,$win_1) Case $tray GUISetState(@SW_HIDE,$win_1) TrayItemSetState ($hideitem, $TRAY_ENABLE) Case $listview _GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview)) EndSwitch Switch $msg1 Case $exittray ExitLoop Case $aboutitem _AboutBox() Case $hideitem GUISetState(@SW_SHOW,$win_1) TrayItemSetState ($hideitem, $TRAY_DISABLE) EndSwitch WEnd GUIDelete($win_1) ExitSo that if the button $copy is pressed ClipPut($edit2) and if $GUI_EVENT_CLOSE GUIDelete($win_3) But i just can't get it working... And wtf is wrong with this code?!: While 1 $333 = GUIGetMsg() Switch $333 Case $GUI_EVENT_CLOSE ExitLoop Case $copy MsgBox(0,'Hey!','Hey JHN?!') EndSwitch WEnd Because in my function for the main window ($win_1), this type of code works just fine :S.... Edited August 28, 2006 by Noobster24 Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc. 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