[SOLVED] Aero-style borders on a non-resizable Gui

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
lblb
Posts: 190
Joined: 30 Sep 2013, 11:31

[SOLVED] Aero-style borders on a non-resizable Gui

07 Oct 2013, 02:12

Hi,

Is there a way for a Gui to have a border that is identical to the border that a resizable Gui would have, without making the Gui resizable. I'm using Windows 7 and, importantly for the look of the border, Windows Aero is turned on.

For example, is there a way to give Gui 2 exactly the same border as Gui 1 without having +Resize in the Gui 2 options? (Again, I'm looking at the "shiny" borders when Aero is turned on.) The only style that I could find (WS_THICKFRAME = 0x40000) is exactly the same one used for +Resize (WS_SIZEBOX) so it makes the Gui resizable.

Code: Select all

Gui, 1: -caption +ToolWindow +AlwaysOnTop +Resize
Gui, 1: Add, Button, w100 h100

Gui, 2: -caption +ToolWindow +AlwaysOnTop
Gui, 2: Add, Button, w100 h100

Gui, 1: Show, x100 y100
Gui, 2: Show, x300 y100

Escape::
ExitApp
Thanks in advance for the help.
Last edited by lblb on 08 Oct 2013, 02:24, edited 1 time in total.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 03:22

Code: Select all

Gui, 2: -Caption +AlwaysOnTop +0x00400000 ; WS_DLGFRAME = 0x00400000
See if this is you want ;)
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 09:14

could you post your finished script?
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 09:15

Guest10 wrote:could you post your finished script?

Code: Select all

Gui, 1: -caption +ToolWindow +AlwaysOnTop +Resize
Gui, 1: Add, Button, w100 h100

Gui, 2: -Caption +AlwaysOnTop +0x00400000 ; WS_DLGFRAME = 0x00400000
Gui, 2: Add, Button, w100 h100

Gui, 1: Show, x100 y100
Gui, 2: Show, x300 y100

Escape::
ExitApp
lblb
Posts: 190
Joined: 30 Sep 2013, 11:31

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 09:47

Hi tmplinshi,

Thanks for the help, much appreciated.

Your solution is nice. It's not exactly what I need (you can see in the image below that the two borders are very different: Aero + resizable Gui on the left, Aero + your solution on the right) but I'll try to see if I can use it. Thanks again. By the way, where did you get this style value from (I can't see it here: http://www.autohotkey.com/docs/misc/Styles.htm)?

Image link: https://www.dropbox.com/s/lpd77s9g5g1kc ... orders.JPG
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 10:52

I got that style from http://msdn.microsoft.com/en-us/library ... s.85).aspx
They looks the same in my Windows XP. (Screenshot)

http://www.autohotkey.com/docs/misc/Styles.htm also listed this style:
WS_DLGFRAME 0x400000 Creates a window that has a border of a style typically used with dialog boxes.
Maybe do something like block drag and replace cursor will work...
lblb
Posts: 190
Joined: 30 Sep 2013, 11:31

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 11:57

Thanks for the help tmplinshi. It's really the Windows Aero thing (which is not available in Win XP) that really changes things. I'll try your suggestion of blocking drag, hopefully this will work. But I'll keep on looking to see if I can find a more direct solution. Thanks for the suggestions.
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: Aero-style borders on a non-resizable Gui

07 Oct 2013, 12:42

lblb: You can use the MinSize and MaxSize properties of Gui to block drag even with +Resize activated. Here is the function that replaces the cursor when it hovers over the sizing borders(use it with OnMessage):

Code: Select all

; Prevent "sizing arrow" cursor when hovering over window border
WM_SETCURSOR(wParam, lParam) { ; WM_SETCURSOR := 0x0020
	; standard arrow cursor
	static HARROW := DllCall("LoadCursor", "Ptr", 0, "Ptr", 32512, "UPtr")
 
	HTCODE := lParam & 0xFFFF
	if (HTCODE > 9) && (HTCODE < 19) { ; cursor is on a border
		DllCall("SetCursor", "Ptr", HARROW) ; show arrow cursor
		return true ; prevent further processing
	}
}
lblb
Posts: 190
Joined: 30 Sep 2013, 11:31

Re: Aero-style borders on a non-resizable Gui

08 Oct 2013, 02:22

This is great, thank you so much Coco. It very much does what I wanted. I may end up using both of the strategies you mention. Cheers! Thanks also to tmplinshi for your help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Noitalommi_2, ulysim and 315 guests