Jump to content

Problem with GUICtrlSetStyle()


jftuga
 Share

Recommended Posts

My script is borderless by default. When I right click on it, I want the Style and StyleEx to change back to default -- that is, have a blue border and the minimize, maximize, and close buttons in the upper-right corner. In the OnToggleStyles function, GUICtrlSetStyle returns failure. I have tried the most recent stable version and the v3.1.1.18 beta. What am I doing wrong in my code?

Thanks,

-John

#include <GUICONSTANTS.au3>
#notrayicon
Opt ("GUIOnEventMode", 1)
Opt ("RunErrorsFatal", 0)

$GUIStyle = $WS_POPUP
$GUIStyleEx = BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)
$TopWin_Y = 615
$TopWin_Width=300
$TopWin = GUICreate("Bug", $TopWin_Width, 20, $TopWin_Y, 20, $GUIStyle, $GUIStyleEx)
GUISetOnEvent( $GUI_EVENT_SECONDARYUP, "OnToggleStyles")
GUISetOnEvent( $GUI_EVENT_PRIMARYUP, "OnExit")
WinSetTrans($TopWin, "", 200)
GUISetState()

while 1
    sleep(1000)
wend

Func OnToggleStyles()
    $rc = GUICtrlSetStyle( $TopWin, -1, -1 )
    GUISetState()
    MsgBox(0,"Debug", "Toggle Style : " & $rc)
endfunc

Func OnExit()
    exit
endfunc
Link to comment
Share on other sites

if you want to change the GUI window style you cannot use GUICtrlSetStyle which relates to a specific control.

There is no specific GUI functions to change the GUI window style.

Perhaps with some DLLcall. I don't remember if somebody did it already.

Good search :(

Link to comment
Share on other sites

if you want to change the GUI window style you cannot use GUICtrlSetStyle which relates to a specific control.

There is no specific GUI functions to change the GUI window style.

Perhaps with some DLLcall. I don't remember if somebody did it already.

Good search :(

<{POST_SNAPBACK}>

I added _TargetSetStyle a couple days ago to "ANYGUI.au3" .(Scripts and Scraps)

You'll need to use _GuiTarget first to 'Target' the window in question.......

It will allow you to change both the Style and the ExStyle of the Targeted Window/Control.......

[u]Do more with pre-existing apps![/u]ANYGUIv2.8
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...