AlienStar Posted December 30, 2010 Share Posted December 30, 2010 hello everybody how can I get GUI like this :I modified the picture in photoshop to express my request the original GUI is :please help me thanks .. Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2010 Share Posted December 30, 2010 You can avoid showing of titlebar by using WS_POPUP style in GUICreate() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AlienStar Posted December 31, 2010 Author Share Posted December 31, 2010 (edited) thanks Zedna but I don't wanna that , by using $WS_POPUP style the border disappeared completely I want the border to be existed but not thick at the top exactly as shown in the picture at the top Edited December 31, 2010 by AlienStar Link to comment Share on other sites More sharing options...
JoHanatCent Posted December 31, 2010 Share Posted December 31, 2010 Is this close enough? GUICreate("My GUI", 300, 100, 10, 10, 0x80880000 + 0x00040000, 0x00000200) Link to comment Share on other sites More sharing options...
UEZ Posted December 31, 2010 Share Posted December 31, 2010 Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
AlienStar Posted December 31, 2010 Author Share Posted December 31, 2010 (edited) @JoHanatCent @UEZ thanks so much that what I need but still there are two problems : - how to prevent sizing ? - how to let it be movable ? thanks again Edited December 31, 2010 by AlienStar Link to comment Share on other sites More sharing options...
Mat Posted December 31, 2010 Share Posted December 31, 2010 This is the easiest way: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUICtrlCreateLabel("", 0, 0, 250, 100, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd AutoIt Project Listing Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2011 Share Posted January 1, 2011 Prevent sizing: just remove WS_SIZEBOX style but when I tried it somehow destroyed frame $hGUI = GUICreate("", 250, 100, -1, -1, BitAND(BitOR($WS_THICKFRAME, $WS_POPUP), BitNOT($WS_SIZEBOX))) ;$hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP) - ($WS_SIZEBOX)) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mat Posted January 1, 2011 Share Posted January 1, 2011 WS_THICKFRAME = WS_SIZEBOX AutoIt Project Listing Link to comment Share on other sites More sharing options...
UEZ Posted January 1, 2011 Share Posted January 1, 2011 (edited) Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $w = 250 + 14 $h = 100 + 14 $hGUI = GUICreate("", $w - 14, $h - 14, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUICtrlCreateLabel("", 0, 0, $w - 14, $h - 14, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_GETMINMAXINFO, "") Exit EndSwitch WEnd Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($minmaxinfo, 7, $w) ; min width DllStructSetData($minmaxinfo, 8, $h) ; min height DllStructSetData($minmaxinfo, 9, $w) ; max width DllStructSetData($minmaxinfo, 10, $h) ; max height Return "GUI_RUNDEFMSG" EndFunc ;==>WM_GETMINMAXINFO I don't know why I've to add 14 to width and height of GUI otherwise the GUI size will be changed only one time (smaller). Happy new year, UEZ Edited January 1, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2011 Share Posted January 1, 2011 (edited) I don't know why I've to add 14 to width and height of GUI otherwise the GUI size will be changed only one time (smaller). I was first who introduced WM_GETMINMAXINFO API into Autoit in 2006 so I know why ;-) It's because width/height in GUICreate defines only ClientSize, i.e. without size of TitleBar/Frame But in WM_GETMINMAXINFO you need size of whole window so you must use WinGetPos like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $w, $h $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUICtrlCreateLabel("", 0, 0, 250, 100, -1, $GUI_WS_EX_PARENTDRAG) GUISetState(@SW_SHOW) $size = WinGetPos($hGUI) $w = $size[2] ; width of window (GUICreate is ClientSize) $h = $size[3] ; height of window (GUICreate is ClientSize) GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_GETMINMAXINFO, "") Exit EndSwitch WEnd Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) #forceref $hWnd, $Msg, $wParam, $lParam Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($minmaxinfo, 7, $w) ; min width DllStructSetData($minmaxinfo, 8, $h) ; min height DllStructSetData($minmaxinfo, 9, $w) ; max width DllStructSetData($minmaxinfo, 10, $h) ; max height Return "GUI_RUNDEFMSG" EndFunc ;==>WM_GETMINMAXINFO And constant 14 is bad for various OS visual settings Classic/XP theme and so on so instead of using constants in such situation you should call DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION) Edited January 1, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
UEZ Posted January 1, 2011 Share Posted January 1, 2011 Thanks Zedna for the information but I've kind of guessed, but it was too late to search for the reason! Now I know it! Happy new year, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Zedna Posted January 1, 2011 Share Posted January 1, 2011 Thanks Zedna for the information but I've kind of guessed, but it was too late to search for the reason!Now I know it!Happy new year,UEZI'm glad I could help littlebecause you helped me a lot!Happy New Year too. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AlienStar Posted January 1, 2011 Author Share Posted January 1, 2011 Guys ... you are so amazing and reliable thanks so so much coz I've got what I need to do by you help thanks again Happy New year to all Link to comment Share on other sites More sharing options...
Mat Posted January 1, 2011 Share Posted January 1, 2011 Ok, so I thought about this all of last night (or tried to anyway...) as I knew there was a way to let you use the border to move the window. It came to me as soon as I woke up of course Process WM_NCHITTEST and tell the window that the caption is being clicked 4 lines of code in the end (plus a blank line and a #forceref line). #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST If you want to process clicks in the client area as normal, then you need to call DefWndProc to see if it's in a size border. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iDef = _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iDef Case $HTBOTTOM, $HTBOTTOMLEFT, $HTBOTTOMRIGHT, $HTLEFT, $HTRIGHT, $HTTOP, $HTTOPLEFT, $HTTOPRIGHT Return $HTCAPTION EndSwitch Return $iDef EndFunc ;==>WM_NCHITTEST Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
UEZ Posted January 1, 2011 Share Posted January 1, 2011 Nice small solution Mat My solution is rather a brute force solution compared to yours! Happy new year, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
AlienStar Posted January 1, 2011 Author Share Posted January 1, 2011 (edited) so cool ideas .. Mat that's fine to get more advanced for this Edited January 1, 2011 by AlienStar Link to comment Share on other sites More sharing options...
Mat Posted January 1, 2011 Share Posted January 1, 2011 I couldn't get the system menu to show on right click by using WM_SYSCOMMAND, so here's a workaround. It doesn't work when pressing the app key... only by using the right mouse button. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MenuConstants.au3> #include <GUIMenu.au3> $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) $hMenu = _GUICtrlMenu_GetSystemMenu($hGUI) _GUICtrlMenu_SetItemState($hMenu, $SC_RESTORE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_SIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MINIMIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MAXIMIZE, $MFS_DISABLED, True, False) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_NCRBUTTONUP, "WM_NCRBUTTONUP") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iDef = _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iDef Case $HTBOTTOM, $HTBOTTOMLEFT, $HTBOTTOMRIGHT, $HTLEFT, $HTRIGHT, $HTTOP, $HTTOPLEFT, $HTTOPRIGHT Return $HTCAPTION EndSwitch Return $iDef EndFunc ;==>WM_NCHITTEST Func WM_NCRBUTTONUP($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If ($wParam = $HTCAPTION) Then Local $iCmd = _GUICtrlMenu_TrackPopupMenu(_GUICtrlMenu_GetSystemMenu($hWnd), $hWnd, _WinAPI_LoWord($lParam), _WinAPI_HiWord($lParam), 1, 1, 2, 1) If ($iCmd <> 0) Then _SendMessage($hWnd, $WM_SYSCOMMAND, $iCmd, $lParam) EndIf Return 0 EndFunc ;==>WM_NCRBUTTONUP AutoIt Project Listing Link to comment Share on other sites More sharing options...
ResNullius Posted January 2, 2011 Share Posted January 2, 2011 I couldn't get the system menu to show on right click by using WM_SYSCOMMAND, so here's a workaround. It doesn't work when pressing the app key... Using Zedna's nifty idea of assigning Accelerators to dummy controls (), this adds app key functionality expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <MenuConstants.au3> #include <GUIMenu.au3> Global Const $SM_CXFIXEDFRAME = 7 $hGUI = GUICreate("", 250, 100, -1, -1, BitOR($WS_THICKFRAME, $WS_POPUP)) $AppKey = GUICtrlCreateDummy() Dim $aAccelKeys[1][2] = [["{APPSKEY}", $AppKey]] GUISetAccelerators($aAccelKeys) $hMenu = _GUICtrlMenu_GetSystemMenu($hGUI) _GUICtrlMenu_SetItemState($hMenu, $SC_RESTORE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_SIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MINIMIZE, $MFS_DISABLED, True, False) _GUICtrlMenu_SetItemState($hMenu, $SC_MAXIMIZE, $MFS_DISABLED, True, False) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_NCRBUTTONUP, "WM_NCRBUTTONUP") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $AppKey $aWinPos = WinGetPos($hGUI) $iBorderOffset = _WinAPI_GetSystemMetrics($SM_CXFIXEDFRAME) $lParam = _WinAPI_MakeLong($aWinPos[0] + $iBorderOffset, $aWinPos[1] + $iBorderOffset) WM_NCRBUTTONUP($hGUI, $WM_NCRBUTTONUP, $HTCAPTION, $lParam) EndSwitch WEnd Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local $iDef = _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) Switch $iDef Case $HTBOTTOM, $HTBOTTOMLEFT, $HTBOTTOMRIGHT, $HTLEFT, $HTRIGHT, $HTTOP, $HTTOPLEFT, $HTTOPRIGHT Return $HTCAPTION EndSwitch Return $iDef EndFunc ;==>WM_NCHITTEST Func WM_NCRBUTTONUP($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If ($wParam = $HTCAPTION) Then Local $iCmd = _GUICtrlMenu_TrackPopupMenu(_GUICtrlMenu_GetSystemMenu($hWnd), $hWnd, _WinAPI_LoWord($lParam), _WinAPI_HiWord($lParam), 1, 1, 2, 1) If ($iCmd <> 0) Then _SendMessage($hWnd, $WM_SYSCOMMAND, $iCmd, $lParam) EndIf Return 0 EndFunc ;==>WM_NCRBUTTONUP Link to comment Share on other sites More sharing options...
Mat Posted January 2, 2011 Share Posted January 2, 2011 Thanks res Thats a pretty good workaround. Is Alt+Space supposed to do the same as the app key? It seems to have the same effect on most windows. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now