Sign in to follow this  
Followers 0
ning

Change a window's style after creation

3 posts in this topic

I've created a window with the $WS_POPUP style. Later on in the script, I want to change it to a normal window with a title and a resizable border. Can I do this programmatically or do I have to destroy the window and create it again?

cheers

ben

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I've created a window with the $WS_POPUP style. Later on in the script, I want to change it to a normal window with a title and a resizable border. Can I do this programmatically or do I have to destroy the window and create it again?

cheers

ben

I could be talking crap as I have not tried anything but what about GUICtrlSetStyle

Edit

I have searched the forums and come up with This topic for you.

Edited by BigDod


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

That's brilliant - thanks for doing that search for me. I made the naive mistake of thinking it was a unique problem that nobody had tried to tackle before. oops.

So I've had a look at AnyGUI, and used it to produce this simple fullscreen toggler script, attached below.

#include "ANYGUIv2.6.au3"
#include <Array.au3>

$hwnd = GUICreate ("Window", 200, 200, -1, -1, BitOR ($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX))
GUISetState (@SW_SHOW)
$fullscreen = False
$coords = WinGetPos ($hwnd)

HotKeySet ("f", "SetPopupStyle")

Do
    $msg = GUIGetMsg ()
Until $msg = $GUI_EVENT_CLOSE

Func SetPopupStyle ()
    ConsoleWrite ("changing" & @LF)
    _TargetStyle ("toggle", 1, BitOR ($WS_CAPTION, $WS_SIZEBOX), -1, $hwnd)
    $fullscreen = Not $fullscreen
    If $fullscreen Then
        $coords = WinGetPos ($hwnd)
        WinMove ($hwnd, "", 0, 0, @DesktopWidth, @DesktopHeight)
    Else
        WinMove ($hwnd, "", $coords[0], $coords[1], $coords[2], $coords[3])
    EndIf
EndFunc

Press 'f' to toggle fullscreen on/off. It remembers the position too. Thanks BigDod & Quaizywabbit!

ben

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