GuiGetStyle Re: GuiSetStyle
"valery_vi" <[email protected]> Thu, 23 Aug 2007 07:21:52 -0000
| Newsgroups | gmane.comp.windows.autoit.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
After v3.2.5.7 (beta) release you can use GuiSetStyle.
Below is an example:
#include <GuiConstants.au3>
$NewStyle = False
$hWnd = GuiCreate("Gui Style", 260, 100)
$Style = GUICtrlCreateButton("Set Style",45, 50, 150, 20 )
$GuiStyles = GuiGetStyle($hWnd)
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($GuiStyles[0],$GuiStyles[1])
GuiCtrlSetData($Style,'Set Style')
$NewStyle = False
endif
Case Else
EndSwitch
WEnd
Valery
--- In [email protected], "valery_vi" <shehrer1@...> wrote:
>
> Hi,
>
> After v3.2.5.6 (beta) release you can use GuiSetStyle.
> Below is an example of func GuiGetStyle:
>
> #include <GuiConstants.au3>
> $NewStyle = False
> $hWnd = GuiCreate("Gui Style", 260, 100)
> $Style = GUICtrlCreateButton("Set Style",45, 50, 150, 20 )
>
> $GuiStyle = GuiGetStyle($hWnd)
>
> 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($GuiStyle[0],$GuiStyle[1])
> GuiCtrlSetData($Style,'Set Style')
> $NewStyle = False
> endif
> Case Else
> EndSwitch
> WEnd
>
> ;===================================
> ; get default GUI styles
> ; returns a two-element array that containing the gui style
information:
> ; $array[0] = style
> ; $array[1] = exStyle
> func GuiGetStyle($hWnd)
> local $Style[2]
> $res = DllCall("User32.dll", "int", "GetWindowLong", "hwnd", $hWnd,
> "int", -16)
> $Style[0] = $res[0]
> $res = DllCall("User32.dll", "int", "GetWindowLong", "hwnd",
> $hWnd, "int", -20)
> $Style[1] = $res[0]
> Return $Style
> endfunc
>
> Valery
>
> --- In [email protected], "valery_vi" <shehrer1@> wrote:
> >
> > Quick version of it:
> >
> > #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)
> > DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd",
> > 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", 0x47)
> > endfunc
> >
> > Valery
> >
> > --- In [email protected], "valery_vi" <shehrer1@> wrote:
> > >
> > > 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
> > >
> >
>