Jump to content

Window Probem & Question


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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