Sign in to follow this  
Followers 0
RAMMRODD

Menu with no Minimize/maximize/exit buttons?

8 posts in this topic

I'm wondering if there is a way to make a GUI without the title bar with these buttons. Like the window I'm looking at now has

(IE icon)AutoIt Forums -> Posting New Topic - Windows Internet Explorer (minimize)(maximize)(close)

is there a way to hide this information on a window I make? I've searched through the Help file but I'm not sure what it would be called. I've searched for hide and title bar but no workie

Any info please

Share this post


Link to post
Share on other sites



Use $WS_POPUP style (0x80000000)


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Too quick to question.....thanks I found it now to learn how to use it.

GUICreate ( "title" [, width [, height [, left [, top [, style [, exStyle [, parent]]]]]]] ) <-----help file

;****************My Attempt**************

;Still Fails

#include <WindowsConstants.au3>

#include <GuiConstantsEx.au3>

GUICreate ( "Test" [, 100 [, 100 [, 0x80000000 ]]] )

it says that the first "[" is an error help?

Edited by RAMMRODD

Share this post


Link to post
Share on other sites

I write 2 examples for you:

1. WS_POPUP Style - Popup

2. 0x16C00000 Style - Title bar without buttons

#include <WindowsConstants.au3>

$GUI = GUICreate("EXAMPLE",400,400,-1,-1,$WS_POPUP)
$EDIT = GUICtrlCreateEdit("$WS_POPUP",0,0,400,300)
$EXIT = GUICtrlCreateButton("EXIT",180,340,40,20)
GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = $EXIT Then 
        GUIDelete($GUI)
        ExitLoop
    EndIf
    Sleep(15)
WEnd

$GUI = GUICreate("EXAMPLE",400,400,-1,-1,0x16C00000)
$EDIT = GUICtrlCreateEdit("0x16C00000",0,0,400,300)
$EXIT = GUICtrlCreateButton("EXIT",180,340,40,20)
GUISetState()

While 1
    $MSG = GUIGetMsg()
    If $MSG = $EXIT Then Exit
    Sleep(15)
WEnd

When the words fail... music speaks

Share this post


Link to post
Share on other sites

thanks that worked great. Now I'm messing with transparency, do you happen to know about that? I found out how to make the pop up transparent but then it also makes the buttons I made transparent. Is there a way to make the whole pop up transparent but the buttons stay at full qualit?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thanks that worked great. Now I'm messing with transparency, do you happen to know about that? I found out how to make the pop up transparent but then it also makes the buttons I made transparent. Is there a way to make the whole pop up transparent but the buttons stay at full qualit?

Here is one way.

You will need to add

#include <windowsconstants.au3>

at the start.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here is Martin's code with my change on positioning and I made the background window pretty much not show up. Question, why does it have to bring up 2 windows? Is the BG window just for movement purposes? It also has a "fade" option and I think I just made the "sleep" long enough to where it doesnt show up lol but its sloppy but works.

Any help is appreciated

EDIT: I started commenting stuff out of the script and realized that I could just remove the BG window. I still wanna know why there was 2 in the script?

#include <GuiConstants.au3>
#include <windowsconstants.au3>

HotKeySet("{ESC}", "QuitApp")
$BG = GUICreate("back windoww",400,400,200,200)
WinSetTrans("back window","",0)
$Main_Gui = GUICreate("", 400, 400,500,200, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)

$But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21)
;$Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220)
GUISetControlsVisible($Main_Gui)
$wp = WinGetPos(WinGetHandle("Untitled"))

;GUISetState(@SW_SHOW,$BG)
GUISetState(@SW_SHOW,$Main_Gui)
GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE")
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUISwitch($BG)
$n = 100
$way = 1
While 1
  $Msg = GUIGetMsg()
if $Msg = $But1 Then Exitloop

WinSetTrans("back window","",$n)
;WinSetTrans($Main_Gui,"",$n);<--------choose this line instead of one above to make the components fade rather than the window

if $n > 253 or $n < 40 then $way *= -1
Sleep(1000000000);<-------------------------adjust for speed of fade
$n += $way
WEnd

Func GUISetControlsVisible($hWnd)
    Local $aClassList, $aM_Mask, $aCtrlPos, $aMask
    
;Set $WS_POPUP style part:
    Local Const $GWL_STYLE = -16
    Local Const $GWL_EXSTYLE = -20
    Local Const $SWP_NOMOVE = 0x2
    Local Const $SWP_NOSIZE = 0x1
    Local Const $SWP_SHOWWINDOW = 0x40
    Local Const $SWP_NOZORDER = 0x4
    
    Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER)
    DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $WS_POPUP)
    DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", $iFlags)
;End Set $WS_POPUP style part
    
    $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF)
    $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    
    For $i = 1 To UBound($aClassList) - 1
        $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i])
        If Not IsArray($aCtrlPos) Then ContinueLoop
        
        $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _
            "long", $aCtrlPos[0], _
            "long", $aCtrlPos[1], _
            "long", $aCtrlPos[0] + $aCtrlPos[2], _
            "long", $aCtrlPos[1] + $aCtrlPos[3])
        DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2)
    Next
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1)
EndFunc

Func _WinGetClassListEx($sTitle)
    Local $sClassList = WinGetClassList($sTitle)
    Local $aClassList = StringSplit($sClassList, @LF)
    Local $sRetClassList = "", $sHold_List = "|"
    Local $aiInHold, $iInHold
    
    For $i = 1 To UBound($aClassList) - 1
        If $aClassList[$i] = "" Then ContinueLoop
        
        If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then
            $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1)
            $iInHold = Number($aiInHold[UBound($aiInHold)-1])
            
            If $iInHold = 0 Then $iInHold += 1
            
            $aClassList[$i] &= "~" & $iInHold + 1
            $sHold_List &= $aClassList[$i] & "|"
            
            $sRetClassList &= $aClassList[$i] & @LF
        Else
            $aClassList[$i] &= "~1"
            $sHold_List &= $aClassList[$i] & "|"
            $sRetClassList &= $aClassList[$i] & @LF
        EndIf
    Next
    
    Return StringReplace(StringStripWS($sRetClassList, 3), "~", "")
EndFunc


Func QuitApp()
    Exit
EndFunc

Func WM_MOVE($hWndGUI)
    If $hWndGUI <> $BG Then Return $GUI_RUNDEFMSG
    Local $ParentPosArr = WinGetPos($hWndGUI)
    WinMove($Main_Gui, "", $ParentPosArr[0], $ParentPosArr[1])
EndFunc

Func WM_ACTIVATE($hWndGUI)
    If $hWndGUI = $BG Then WinActivate($Main_Gui)
EndFunc
Edited by RAMMRODD

Share this post


Link to post
Share on other sites

Here is Martin's code with my change on positioning and I made the background window pretty much not show up. Question, why does it have to bring up 2 windows? Is the BG window just for movement purposes? It also has a "fade" option and I think I just made the "sleep" long enough to where it doesnt show up lol but its sloppy but works.

Any help is appreciated

EDIT: I started commenting stuff out of the script and realized that I could just remove the BG window. I still wanna know why there was 2 in the script?

Maybe you should read the whole thread that I linked to, but I would have thought it was pretty obvious from what you've done. BY stopping the background window from showing you have no longer got a semi transparent background, just controls on a totally transparent background.

The main idea of the thread is to showhow to have solid controls on a transparent window so all you see is the controls. But JamesB (I think it was) wanted to know if you could have a variable transparent background. So I added a window which can have its transparency adjusted so that the controls aren't affected. The WM_MOVE function keeps the controls in position as you move the background.

If you don't want the variable transparent background then look at the earlier posts in that thread particularly

Another thread that I should have remembered before is this one by ChrisL.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0