Jump to content
Miliardsto

Send msg to message loop (while loop)

Recommended Posts

Posted (edited)

Hello I need send msg to controls ( to message loop - main while loop ) like this func do. I need to send msg to hided (no display on screen) gui too.

GUICtrlSendMsg ( controlID, msg , wParam, lParam )

I could make simply run functions but I has a lot of logic in while loop like this.

So need to fire fire example (on hided gui too) $s_offOn_sio

Case $s_offOn_sio
            If _Metro_CheckboxIsChecked($s_offOn_sio) Then
                _Metro_CheckboxUnCheck($s_offOn_sio)
                AdlibUnRegister("hsio")
            Else
                If _checkDeclared(True,True) == False Then 
                Else
                    _Metro_CheckboxCheck($s_offOn_sio)
                     AdlibRegister("hsio", 1900)
                EndIf
            EndIf

        Case $s_offOn_spell
            If _Metro_CheckboxIsChecked($s_offOn_sp) Then
                _Metro_CheckboxUnCheck($s_offOn_sp)
                AdlibUnRegister("caster")
            Else
                If _checkDeclared(True,True) == False Then 
                Else
                    _Metro_CheckboxCheck($s_offOn_sp)
                    AdlibRegister("caster", 3500)
                Endif
            EndIf


        Case $r_offOn_increase
            If _Metro_CheckboxIsChecked($r_offOn_increase) Then
                _Metro_CheckboxUnCheck($r_offOn_increase)
            Else
                _Metro_CheckboxCheck($r_offOn_increase)
            EndIf

 

Edited by Miliardsto

Share this post


Link to post
Share on other sites

how to run this "Cases" in message loop . Normally its fired up when button or switch is clicked. I need to simulate click on these buttons or send some function to run it.

Like I wrote I wont like to simply call funcs becouse in while loop I got all the logic before function could be fired. I wont spend 3 days rewriting code

Case $r_offOn_increase
     
Case $s_offOn_sio

Share this post


Link to post
Share on other sites

xD take. how to run $idButton_Add without clicking button Add , when gui is hidden too?

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $sMESSAGE = "The following buttons have been clicked"

    GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

    Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
    Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
    Local $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
    GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling
    GUICtrlSetData(-1, $sMESSAGE)
    Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton_Add
                GUICtrlSetData($idMylist, "You clicked button No1|")
            Case $idButton_Clear
                GUICtrlSetData($idMylist, "")
            Case $idButton_Close
                MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2)
                Exit
        EndSwitch
    WEnd
EndFunc   ;==>Example

 

Share this post


Link to post
Share on other sites

HotKeySet could call a function that could send a command to click the button, but you can't click a button without some way of telling it to click the button. Otherwise, what would be the point of having the buttons?

BTW, if this is somehow related to game automation, you'd better read the forum rules.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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

×
×
  • Create New...