Sign in to follow this  
Followers 0
VicTT

Code piece

9 posts in this topic

#1 ·  Posted (edited)

K..so what's wrong with this piece of code???It starts the GUI for a second and then it closes just like that..what am I missing?

#include <GUIConstants.au3>
$child=GuiCreate("Parinte",400,400)
$button=GUICtrlCreateButton ("OK",  10, 30, 50)
GuiSetState(@SW_SHOW)
While 1
    $msg=GuiGetMsg(1)
    if ($msg[1]=$child)&&($msg[0]=$GUI_EVENT_CLOSE) then 
        GuiDelete($child)
    EndIf
    if $msg[0] = $GUI_EVENT_CLOSE then ExitLoop
    if $msg[0] = $button then 
        $child=GuiCreate("Copil",100,200,-1,-1,-1,-1,$child)
    GuiSetState(@SW_SHOW,$child)
EndIf
    WEnd

Edited : My bad..it doesn't even compile..:(

Edited by VicTT

[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites



You're having a 60's moment switching between too many programming languages.

Try using AND instead of &&

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

hope the below helps...

#include <GUIConstants.au3>
$child = "x"
$parent = GUICreate("Parinte",400,400)
$button = GUICtrlCreateButton ("OK",  10, 30, 50)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg(1)
    If $msg[0] = 0 Then
        ContinueLoop
    ElseIf $msg[1] = $child And $msg[0] = $GUI_EVENT_CLOSE  Then
        GUIDelete($child)
    ElseIf $msg[1] == $parent And $msg[0] = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg[0] == $button Then
        $child = GUICreate("Copil",200,200,-1,-1,-1,-1,$parent)
        GUISetState(@SW_SHOW,$child)
    Else
        ContinueLoop
    EndIf
Wend
Exit

Share this post


Link to post
Share on other sites

LOL!

DaleHohm is right :()..lols..yea..I'm used to&like PASCAL, HAVE to know C, and WANT to get to know AutoIt..thus, the above code piece appeared..:

Thanks alot, everyone :(


[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites

Hmmm..one lil problem..if you spawn 2 windows using the OK button, the 2nd one closes just fine by the almighty "X" button, but the 1st seems to resist every attempt to be closed..


[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites

Are using the example that i posted?

Share this post


Link to post
Share on other sites

Sure am


[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites

when i run the script the $parent window closes when using the x. This line of code handles that event.

ElseIf $msg[1] == $parent And $msg[0] = $GUI_EVENT_CLOSE Then
        ExitLoop

Share this post


Link to post
Share on other sites

Well..Start the proggie..open up 2 windows by pressing OK TWICE!!!Close the 1st one and..surprise..the 2nd doesn't close :(..


[quote]Together we might liveDivided we must fall[/quote]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0