Sign in to follow this  
Followers 0
JØhñ ï§ §¢rïþ�ïñg ¥ðµr mðm

Help Me Please

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



WOMP.

Share this post


Link to post
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.

Share this post


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

Share this post


Link to post
Share on other sites

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

Beat me to it, lol.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I was wondering the same thing.. if we can have opt("GUIOnEventMode",1) reset back to opt("GUIOnEventMode",0) , for other functions of the script that dont use it, that would be cool.

Share this post


Link to post
Share on other sites

Beat me to it, lol.

:think:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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.

Share this post


Link to post
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:

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
Sign in to follow this  
Followers 0