GuiSetStyle

"valery_vi" <[email protected]> Thu, 16 Aug 2007 07:13:05 -0000
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
Hi,

I saw Q about this subject. So, you can use this func GuiSetStyle to
reset style of GUI very easy. Try this GuiStyle.au3 :

#include <GuiConstants.au3>
$NewStyle = False
$hWnd = GuiCreate("Gui Style", 260, 100)
$Style = GUICtrlCreateButton("Set Style",45, 50, 150, 20 )
GUISetState()

While 1
 $Msg = GUIGetMsg()
 Switch $Msg
  Case -3
   Exit
  Case $Style
   if not $NewStyle then
    GuiSetStyle($WS_POPUPWINDOW+$WS_THICKFRAME,$WS_EX_CLIENTEDGE +
$WS_EX_TOOLWINDOW)
    GuiCtrlSetData($Style,'Undo Style')
    $NewStyle = True
   else
    GuiSetStyle()
    GuiCtrlSetData($Style,'Set Style')
    $NewStyle = False
   endif
   Case Else
   EndSwitch
WEnd

;Set Gui Styles
func GuiSetStyle($Style=-1,$ExStyle=0)
Global $GWL_STYLE = -16
Global $GWL_EXSTYLE = -20
 if $Style=-1 then
$Style=$WS_MINIMIZEBOX+$WS_CAPTION+$WS_POPUP+$WS_SYSMENU
 $res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd,
"int", $GWL_STYLE, "int", $Style)
 $res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd,
"int", $GWL_EXSTYLE, "int", $ExStyle)
 WinSetState($hWnd,'', @SW_HIDE)
 WinSetState($hWnd,'', @SW_SHOW)
endfunc

Enjoy,
Valery