Jump to content

Recommended Posts

Posted

Hello all :D

im Wondering about how to Display two MSG Boxes at Once ?

if i Wrote :

MsgBox(0, "Test", "Hello")
MsgBox(0, "Test", "Hello")

The First Message Will Display and if we pressed ok the other will show

i want to have a code that Display the two Messages at once

  • Moderators
Posted

TarwadaC4,

Welcome to the AutoIt forum. :D

You could use Yashied's NotifyBox UDF. Or code it yourself something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Show", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            _Double_Box()
    EndSwitch

WEnd

Func _Double_Box()

    $iCount = 2

    $hBox_1 = GUICreate("MsgBox 1", 200, 200, 100, 100, BitOR($WS_POPUPWINDOW, $WS_CAPTION))
    $hButton_1 = GUICtrlCreateButton("OK", 10, 10, 80, 30)
    GUISetState()

    $hBox_2 = GUICreate("MsgBox 2", 200, 200, 100, 400, BitOR($WS_POPUPWINDOW, $WS_CAPTION))
    $hButton_2 = GUICtrlCreateButton("OK", 10, 10, 80, 30)
    GUISetState()

    While 1

        $aMsg = GUIGetMsg(1)
        Switch $aMsg[1]
            Case $hBox_1
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE, $hButton_1
                        GUIDelete($hBox_1)
                        $iCount -= 1
                EndSwitch
            Case $hBox_2
                Switch $aMsg[0]
                    Case $GUI_EVENT_CLOSE, $hButton_2
                        GUIDelete($hBox_2)
                        $iCount -= 1
                EndSwitch
        EndSwitch
        If $iCount = 0 Then Return
    WEnd

EndFunc

Try to understand how it works. Please ask questions if you do not. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

this is Display two Forms not message boxes ....

ok i have another question, if i want my script to repeat the "Space" button 10 times if i pressed Space how the code Could be ?

Sorry im new to this language and i like it so so much :D

  • Moderators
Posted

TarwadaC4,

  Quote

im new here

So new that you have obviously not yet had time to read the Forum Rules. If you do so now you will see that we do not support any scripts to do with gaming - so do not expect any more help on that part of the thread. :oops:

  Quote

i want to learn

Good! :D

Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. :rip:

Have fun learning to code with AutoIt - but remember, no games-related scripts in the future! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)

It's very important that you read the forum rules. Discussion about gaming or posting scripts for gaming is not accepted here.

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

Stick to the message boxes and you will be fine. I won't report this, but please follow the rules.

Edit

Ah Melba got there first.

Edited by czardas
Posted

About the message boxes. You need to create them like Melba showed. You can resize and add all the buttons you want to make them look more like a message box. Check out GUICreate in the help file and look at examples on the forum also.

Posted

#include <GUIConstants.au3>

Example() ; Run the example

Func Example() ; Example of a basic function
    Local $hGUI = GUICreate("Test Button", 200, 150) ; Create GUI
    Local $hBtn = GUICtrlCreateButton("Click Me", 10, 10) ; Create button
    GUISetState()
    While 1
        $msg = GUIGetMsg() ; Get messages sent to the GUI
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop ; Exiting the loop here terminates all commands
        If $msg = $hBtn Then MsgBox(0, "Info", "You clicked the button")
    WEnd
EndFunc

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
  • Recently Browsing   0 members

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