Sign in to follow this  
Followers 0
YoseMite

Move a GUI

7 posts in this topic

Hey,

I use this script:

#include <GuiConstants.au3>
GuiCreate("My message box", 400, 78,(@DesktopWidth-400)/2, (@DesktopHeight-78)/2, $WS_POPUP + $WS_DLGFRAME)
$Button = GuiCtrlCreateButton("X", 370, 0, 30, 30)
GUICtrlSetFont($Button, 24)
$Label = GuiCtrlCreateLabel("", 0, 0, 370, 30 )
GUICtrlSetBkColor(-1,0x8080ff)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
       Case $msg = $Button
        ExitLoop
    EndSelect
WEnd

It works perfect but now I would move the GUI with my mouse...

How can I do this?

Greetz,

YoseMite

Share this post


Link to post
Share on other sites



Why not just use

#include <GuiConstants.au3>
GuiCreate("My message box", 400, 78,(@DesktopWidth-400)/2, (@DesktopHeight-78)/2)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
       Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd

And you can move it anywhere you want.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Because I doesn't wanna to see the GUI.

Edited by YoseMite

Share this post


Link to post
Share on other sites

Because I doesn't wanna to see the GUI.

What do you want to see


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
$GUI = GUICreate("My message box", 400, 78, -1, -1, BitOR($WS_POPUPWINDOW, $WS_BORDER))
$Button = GUICtrlCreateButton("X", 370, 0, 30, 30)
GUICtrlSetFont($Button, 24)
$Label = GUICtrlCreateLabel("", 0, 0, 370, 30)
GUICtrlSetBkColor(-1, 0x8080ff)
$Label2 = GUICtrlCreateLabel("This is a test, this is only a test", 0, 30, 400, 48)
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $Button
         Exit
      Case $msg = $Label Or $msg = $Label2
         _Drag($GUI)
   EndSelect
WEnd

Func _Drag($h_gui)
   DllCall("user32.dll", "int", "ReleaseCapture")
   DllCall("user32.dll", "int", "SendMessage", "hWnd", $h_gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc  ;==>_Drag


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#include <GuiConstants.au3>
$GUI = GUICreate("My message box", 400, 78, -1, -1, BitOR($WS_POPUPWINDOW, $WS_BORDER))
$Button = GUICtrlCreateButton("X", 370, 0, 30, 30)
GUICtrlSetFont($Button, 24)
$Label = GUICtrlCreateLabel("", 0, 0, 370, 30)
GUICtrlSetBkColor(-1, 0x8080ff)
$Label2 = GUICtrlCreateLabel("This is a test, this is only a test", 0, 30, 400, 48)
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $Button
         Exit
      Case $msg = $Label Or $msg = $Label2
         _Drag($GUI)
   EndSelect
WEnd

Func _Drag($h_gui)
   DllCall("user32.dll", "int", "ReleaseCapture")
   DllCall("user32.dll", "int", "SendMessage", "hWnd", $h_gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc ;==>_Drag
Awesome!!, I was sitting here trying to mess with it, and had it moving, but constantly lost focus!

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thank you, this is exactly what I neet!! :geek:

You're the best! :o

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