Jump to content

Recommended Posts

Hey Im new here :think: I need help with gui, please

#include <GuiConstants.au3>
GuiCreate("My Screen", 600, 600)
$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)
GuiCtrlSetOnEvent($MyButton1, "dll")
GuiSetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Func dll()
    DllCall(.........................................My dll)
EndFunc

is that the proper way to call a dll with a botton?

Hi, I have been with autoit since

MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)
My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked.
Link to comment
Share on other sites

WOMP.

..... you probability didn't understand my question, or there is no dll call for a gui botton.

I need a GUI with a botton to call a dll for my script please help

Hi, I have been with autoit since

MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)
My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked.
Link to comment
Share on other sites

i think you just forgot opt("GUIOnEventMode",1), thats all.

#include <GuiConstants.au3>
opt("GUIOnEventMode",1)

GuiCreate("My Screen", 600, 600)
$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)
GuiCtrlSetOnEvent($MyButton1, "dll")
GuiSetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Func dll()
DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
EndFunc
Link to comment
Share on other sites

:think: god im stupid didn't even see that, but one little problem it did exit until i add that to my code.

but if I am correct this should make it exit

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

plus I have added Exit at the end of my script, ill try looking more for my problem

Hi, I have been with autoit since

MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)
My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked.
Link to comment
Share on other sites

try this..

#include <GuiConstants.au3>
opt("GUIOnEventMode",1)

GuiCreate("My Screen", 600, 600)
$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)
GuiCtrlSetOnEvent($MyButton1, "dll")
GuiSetOnEvent($GUI_EVENT_CLOSE,"_exit") 
GuiSetOnEvent($GUI_EVENT_MAXIMIZE,"_maximize")
GuiSetOnEvent($GUI_EVENT_MINIMIZE,"_minimize")
GuiSetState()
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
    
Func dll()
DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
EndFunc

func _exit()
    Exit
EndFunc

func _minimize()
    GUISetState(@SW_MINIMIZE,$MyButton1)
EndFunc

func _maximize()
    GUISetState(@SW_MAXIMIZE,$MyButton1)
EndFunc
Edited by slightly_abnormal
Link to comment
Share on other sites

Does anyone remember how GUIGetMsg() and GUIOnEventMode don't get along?

#include <GuiConstants.au3>
opt("GUIOnEventMode",1)

GuiCreate("My Screen", 600, 600)
$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)
GuiCtrlSetOnEvent($MyButton1, "dll")
GuiSetOnEvent($GUI_EVENT_CLOSE,"_exit")
GuiSetState()
While 1
    Sleep (100)
Wend
    
Func dll()
DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
EndFunc

func _exit()
    Exit
EndFunc

That's all you need.

Link to comment
Share on other sites

yo can you tell me how i can add a winzip file on this site my first program is made already :think: youshould try it ill post it in the scripts and scraps and post a link on this post to.

edited; found it :(

SnapShot

Edited by JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm

Hi, I have been with autoit since

MsgBox(4096, "I registered", "I have been with the autoit forums since 4/27/2006", 10)
My hobbys, partying, messing up computers, throwing things, riding to places i shouldntMy qoutes, me?....i always tell the truth......even when i lie, you got small words for a big mouth, im not getting sex but i sure am getting fucked.
Link to comment
Share on other sites

GuiCreate("My Screen", 600, 600)

$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)

GuiCtrlSetOnEvent($MyButton1, "dll")

GuiSetState()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Func Dll()

EndFunc

is that the proper way to call a dll with a botton?

To answer your question: No, read the above. Also the point of using the On Event mode in GUI's is that you don't have to continuously check if something has happened. Right now, you are making a combination of a on event mode and the default mode, where you have to check for messages. In your script you don't have a long while loop with all kinds of data so you could just use your GUI in default mode: You should change it to this:

#include <GuiConstants.au3>

GuiCreate("My Screen", 600, 600)
$MyButton1 = GuiCtrlCreateButton("my dll", 126, 240, 200, 20)
GuiSetState()
While 1
   $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE then
          _exit()
    endif
    
    if $msg = $MyButton1 Then
         dll()
    endif
    Sleep (100)
Wend
    
Func dll()
DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)
EndFunc

func _exit()
    Exit
EndFunc

Alternately, you can use the script from greenmachine that uses only On Event mode. I just thought you should know.. :think:

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