Jump to content

Code piece


VicTT
 Share

Recommended Posts

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

 

Link to comment
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

Link to comment
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
Link to comment
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

 

Link to comment
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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...