Sign in to follow this  
Followers 0
PantZ4

Adding a close button?

15 posts in this topic

Hey everyone.

I'm trying to make a child GUI which only have a title and a close button. The title can easily acquired by adding $WS_CAPTION to the style but what about a close button?

$WS_SYSMENU isn't the wanted effect I want as it also adds a window menu and icon to the GUI but I only want the close button. I couldn't find anything in the help file. Anyone got the style I need to apply, to my GUI on the top of their mind?

Thanks.

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Variable used without being declared.:
$Form1 = GUICreate("Form1", 633, 447, 193, 125, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
$Form1 = GUICreate("Form1", 633, 447, 193, 125, BitOR(^ ERROR

*Edit: And not to mention that even if it's working, it's explicitly NOT what the OP asked for. Maybe he was misread, so I'll bold the important parts.

$WS_SYSMENU isn't the wanted effect I want as it also adds a window menu and icon to the GUI but I only want the close button.

If I had to guess, I'd say he wants a window like MsgBox(0, '', '') gives. Although it should be noted that it still has a window menu, it's just not accessible via a title icon (must press Alt+Space). Edited by Saunders

Share this post


Link to post
Share on other sites

Here is a image of what I mean:

As you see within the red rectangle this title bar doesn't have the icon.

Saunders @ About they can access the window menu doesn't matter. It just the icon I want gone. But thanks for enlighten me with the hotkey. Didn't even know you could do that :).

Sorry for my English :).

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I'm still using version 3.2.10.0 lol. Try it now (still untested with the latest release, I'm downloading it, but this should be fixed now.\

EDIT: @Saunders- He asked for a title and a close button... He provided no code to show what he had done, so I gave him something to work with, to see if he could figure it out himself.

Edited by Bert

Share this post


Link to post
Share on other sites

He asked for a title and a close button... He provided no code to show what he had done, so I gave him something to work with, to see if he could figure it out himself.

Well I would love to figure it out myself but I have already tried various ways to get my wanted effect.

Heck, I even tried to use Au3Info to get the style and then apply it. Still no luck.

Share this post


Link to post
Share on other sites

Mr. Zero

This?

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test GUI", 300, 200, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU), $WS_EX_TOOLWINDOW)

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Yes! That is exactly what I want. Thank you. :)

Well if I'm allowed to be a bit picky, you might notice that the title bar have become smaller by the $WS_EX_TOOLwindow. Is there any alternative to this? I tried some other $WS_EX but it seems only toolwindow works. :)

Share this post


Link to post
Share on other sites

Mr. Zero

Well if I'm allowed to be a bit picky, you might notice that the title bar have become smaller by the $WS_EX_TOOLwindow.

Hmm...this is a trick:

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test GUI", 300, 200, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU))

GUISetState()

DllCall("user32.dll", "int", "SendMessage", "hwnd", $hGUI, "int", $WM_SETICON, "int", 1, "str", 0)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $hGUI, "int", $WM_SETICON, "int", 0, "str", 0)
DllCall("user32.dll", "int", "DrawMenuBar", "hwnd", $hGUI)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

But system menu don`t removed.

Share this post


Link to post
Share on other sites

What are the DllCall's supposed to be doing? I commented them out and the window looks and acts the same to me.

Share this post


Link to post
Share on other sites

Saunders

What are the DllCall's supposed to be doing? I commented them out and the window looks and acts the same to me.

Remove the window icon. :)

Posted Image

Share this post


Link to post
Share on other sites

I find this method better if you want to remove the icon

Global $sFilename = @SystemDir & "\shell32.dll"

GuiSetIcon($sFilename, -50)

Share this post


Link to post
Share on other sites

Set the empty icon? :)

Share this post


Link to post
Share on other sites

yes :)

Share this post


Link to post
Share on other sites

Saunders

Remove the window icon. :)

[img removed]

I did not get that result.

I find this method better if you want to remove the icon

Global $sFilename = @SystemDir & "\shell32.dll"

GuiSetIcon($sFilename, -50)

That works though.

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