Jump to content
Sign in to follow this  
unknown12

Window Probem & Question

Recommended Posts

unknown12

I have created a program with auto it, but the close button (X) won't work this is the code i'm using.

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("VirtuaDrums", 450, 535,(@DesktopWidth-450)/2, (@DesktopHeight-535)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

2. How can I stop the window being resizable?

thanks.

Share this post


Link to post
Share on other sites
automagician

For #2, if there isn't a better way through the AutoIt GUI functions, you can always use a Dll call:

$Hwnd = WinGetHandle("YOUR WINDOW")

$menu = DllCall("user32.dll","hwnd","GetSystemMenu","hwnd", $Hwnd, "int",0)
DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", 0xF000, "int", 0x0);removes SC_SIZE

DllCall("user32.dll", "int", "RemoveMenu", "hwnd", $menu[0] , "int", 0xF030, "int", 0x0);removes SC_MAXIMIZE

Edit: Regarding #1, have you tried something along these lines:

GUISetOnEvent($GUI_EVENT_CLOSE, "_Foo")
Func _Foo()
    Exit(0)
EndFunc

I haven't worked a lot with the AutoIt GUI's so if it doesn't work I am sorry, I am just trying to help. So I hope that helps a little, but there has to be an AutoIt function that controls the sizing functionality.

Regards...

Edited by automagician

Share this post


Link to post
Share on other sites
unknown12

don't want to call a dll, and i'm sure there theres a simpler way.

i'll try the second one

EDIT: Second dosn't work

Edited by unknown12

Share this post


Link to post
Share on other sites
Jos

example where the X works and the window cannot be resized:

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("VirtuaDrums", 450, 535,(@DesktopWidth-450)/2, (@DesktopHeight-535)/2 , $WS_SYSMENU)
GUISetState (@SW_SHOW)    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
unknown12

thanks

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  

×