Jump to content

Guigetmsg() With Adlibenable


Recommended Posts

HiHo :mellow:,

already discovered this great tool last year, but just recently started actually playing around with it, superb :)...

Now I saw the AdlibEnable function in the help-file.

My current project involves quiet a large number of loops in it, and in all sub-loops i have to do a seperat poll to the GuiGetMsg(). Is there anything that stands against doing it like this?

#include <GuiConstants.au3>

dim $msg

GuiCreate("Login", 342, 126,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Username", 10, 10, 200, 50)
$Input_2 = GuiCtrlCreateInput("", 20, 30, 180, 20)
$Input_3 = GuiCtrlCreateInput("", 20, 90, 180, 20,$ES_PASSWORD)
$Group_4 = GuiCtrlCreateGroup("Password", 10, 70, 200, 50)
$Button_5 = GuiCtrlCreateButton("Login", 230, 50, 80, 30)

GuiSetState()

AdlibEnable("pollgui",100)

While 1
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    EndSelect
WEnd
Exit

Func pollgui()
    Global $msg = GuiGetMsg()
EndFunc

The code itself I just copied from another thread, my questions just about the AdlibEnable thingy.

It works, but you never known the side effects :),:o or something like that...

This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Why not just use

#include <GuiConstants.au3>

dim $msg

GuiCreate("Login", 342, 126,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Group_1 = GuiCtrlCreateGroup("Username", 10, 10, 200, 50)
$Input_2 = GuiCtrlCreateInput("", 20, 30, 180, 20)
$Input_3 = GuiCtrlCreateInput("", 20, 90, 180, 20,$ES_PASSWORD)
$Group_4 = GuiCtrlCreateGroup("Password", 10, 70, 200, 50)
$Button_5 = GuiCtrlCreateButton("Login", 230, 50, 80, 30)

GuiSetState()

While 1
$msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Exit

?

~cdkid

Edited by cdkid
AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

Because of the sub-loops. My program is more something like

...
GuiSetState()

AdlibEnable("pollgui",50)

While 1
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else

        while $x < 10

            while $y < 10

                while $a < 10

                    sleep(5000)

                WEnd

                sleep(1000)

            WEnd

            while $z < 10

            WEnd

        WEnd

    EndSelect
WEnd
Exit

Func pollgui()
    Global $msg = GuiGetMsg()
EndFunc

with lots of loops and sleeps, and escpecially runwaits. For the first one I would have to add a $msg = Guigetmsg() to every loop, I guess for the second and third the keystrokes would not be catched proberly.

Edit: Typo

Edited by Polyphem
This post will be edited again by Polyphem: Tomorrow, 11:55 AM
Link to comment
Share on other sites

Because of the sub-loops. My program is more something like

...
GuiSetState()

AdlibEnable("pollgui",50)

While 1
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else

        while $x < 10

            while $y < 10

                while $a < 10

                    sleep(5000)

                WEnd

                sleep(1000)

            WEnd

            while $z < 10

            WEnd

        WEnd

    EndSelect
WEnd
Exit

Func pollgui()
    Global $msg = GuiGetMsg()
EndFunc

with lots of loops and sleeps, and escpecially runwaits. For the first one I would have to add a $msg = Guigetmsg() to every loop, I guess for the second and third the keystrokes would not be catched proberly.

Edit: Typo

As AutoIt is a monothread it will be difficult to simulate a multithread.

Perhaps you can have a look to the GUIOnEvent method but I am almost sure you will get limitation due the lack of multithreading :)

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...