daveed Posted July 18, 2008 Posted July 18, 2008 (edited) Hallow, How do you create a popup gui with only a close button in the title bar and no left icon and menu. i tryed BitOr($WS_CAPTION, $WS_SYSMENU+$WS_EX_TOOLWINDOW) and BitOr($WS_CAPTION, $WS_EX_TOOLWINDOW) Edited July 18, 2008 by daveed
Paulie Posted July 18, 2008 Posted July 18, 2008 I think $WS_EX_TOOLWINDOW is what you are looking for, but i think you are doin it wrong muttley GuiCreate("Title", 200, 100, -1, -1, Default, $WS_EX_TOOLWINDOW)
BrettF Posted July 18, 2008 Posted July 18, 2008 $WS_* is a normal window style constand$WS_EX_* is an extended window style constant... You'll notice they are in different places in GUI Create.GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] )To combine use BitOR (), and if you only need to set an extended style, and not a normal one, use -1 or default, as Paulie showed in his code.Cheers,Brett muttley Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
daveed Posted July 19, 2008 Author Posted July 19, 2008 Thanks guys! For the help ive got a bit of a better understanding now. Cheers!
rundmv Posted October 17, 2008 Posted October 17, 2008 Is it possible to create a window similar to the $WS_EX_TOOLWINDOW (no icon menu, no minimize/maximize, with close button), but with the normal titlebar height? $WS_EX_TOOLWINDOW has the narrower titlebar.
wraithdu Posted October 18, 2008 Posted October 18, 2008 $hwnd = GUICreate("", 200, 100, -1, -1, BitOR($WS_CAPTION, $WS_POPUPWINDOW)) GUISetIcon(@AutoItExe, -2)
wraithdu Posted October 18, 2008 Posted October 18, 2008 As far as I know you must have the $WM_SYSMENU style in order to have the X (close) button, so you're stuck with it unless you go the $WS_EX_TOOLWINDOW route.
wraithdu Posted October 18, 2008 Posted October 18, 2008 I found a few ways to do it actually, but this seems like the best - #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hwnd = GUICreate("", 200, 100, -1, -1, BitOR($WS_CAPTION, $WS_POPUPWINDOW)) GUISetIcon(@AutoItExe, -2) GUIRegisterMsg($WM_NCLBUTTONDOWN, "MY_HITTEST") GUIRegisterMsg($WM_NCRBUTTONDOWN, "MY_HITTEST") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func MY_HITTEST($hWnd, $Msg, $wParam, $lParam) Switch $wParam Case $HTSYSMENU Return 1 Case $HTCAPTION Switch $Msg Case $WM_NCRBUTTONDOWN Return 1 EndSwitch EndSwitch EndFunc
rasim Posted October 18, 2008 Posted October 18, 2008 (edited) wraithduHe he... Nice! But the system menu area not draggable Another method:#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> $hwnd = GUICreate("Test GUI", 200, 100, -1, -1, BitOR($WS_CAPTION, $WS_POPUPWINDOW)) GUISetIcon(@AutoItExe, -2) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NCHITTEST($hWnd, $Msg, $wParam, $lParam) Local $iProc = DllCall("user32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $Msg, "wparam", $wParam, "lparam", $lParam) If $iProc[0] = $HTSYSMENU Then Return $HTCAPTION EndFunc Edited October 18, 2008 by rasim
wraithdu Posted October 18, 2008 Posted October 18, 2008 (edited) Heh, guess you didn't test that bit of code? WM_NCHITTEST was the first message I tried, but it's only sent for client coords, not when clicking in the titlebar, sysmenu, min / max / close buttons, etc. Oh, and the sysmenu area isn't draggable under normal circumstances anyway. Bear in mind all my testing is on Vista (just in case XP is different.) I used Spy++ to catch all the messages. Most of ones that we can capture and block are the two I used above, and WM_SYSCOMMAND. BUT, there's a discrepancy with WM_SYSCOMMAND. MSDN says that the wParam of a WM_SYSCOMMAND message should be SC_MOUSEMENU when the mouse invokes the sysmenu, and that value is 0xF090. Spy++ shows the message as WM_SYSCOMMAND with a uCmd (don't know what that means) value of SC_MOUSEMENU, but when I look deeper, the wParam is 0xF093. That doesn't make sense. Maybe the message value was changed on vista? I don't know, but try this - expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3>; for $SC_MOUSEMENU constant $hwnd = GUICreate("", 200, 100, -1, -1, BitOR($WS_CAPTION, $WS_POPUPWINDOW)) GUISetIcon(@AutoItExe, -2) GUIRegisterMsg($WM_SYSCOMMAND, "MY_HITTEST") GUIRegisterMsg($WM_NCRBUTTONDOWN, "MY_HITTEST") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func MY_HITTEST($hWnd, $Msg, $wParam, $lParam) Switch $Msg Case $WM_SYSCOMMAND Switch $wParam Case $SC_MOUSEMENU ConsoleWrite("SC_MOUSEMENU : " & $wParam & @CRLF) Return _WinAPI_DefWindowProc($hWnd, $WM_NCLBUTTONDOWN, $HTCAPTION, $lParam) Case 0xF093 ConsoleWrite("Unknown : " & $wParam & @CRLF) Return _WinAPI_DefWindowProc($hWnd, $WM_NCLBUTTONDOWN, $HTCAPTION, $lParam) EndSwitch Case $WM_NCRBUTTONDOWN Switch $wParam Case $HTCAPTION Return 1 EndSwitch EndSwitch EndFunc Edited October 19, 2008 by wraithdu
wraithdu Posted October 18, 2008 Posted October 18, 2008 PS - board doesn't seem to like <autoit></autoit> tags right now....
rasim Posted October 19, 2008 Posted October 19, 2008 (edited) wraithduWM_NCHITTEST was the first message I tried, but it's only sent for client coords, not when clicking in the titlebar, sysmenu, min / max / close buttons, etc.What? You read this? I think that the WM_NCHITTEST is sent to a Non Client area.wraithduall my testing is on VistaI don't have the Vista. P.S.My example don't work under Vista? Edited October 19, 2008 by rasim
wraithdu Posted October 19, 2008 Posted October 19, 2008 Hmm, I guess I misinterpreted my previous results a bit. Ok, so WM_NCHITTEST is in fact sent from the caption bar. But at least under Vista I never get the HTSYSMENU message. I only get HTCAPTION and HTCLIENT. So yes, your example fails on Vista. Too bad Microsoft can't keep basic things consistent between OS's.
BrettF Posted October 19, 2008 Posted October 19, 2008 Nice examples guys Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
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