Hello,
Many many thanks for your reply!
It works, but please note the following:
If we apply Gui, -Caption , and then Gui, +Resize as in the following example, there is a thick BORDER added if we click in any area of Desktop outside the GUI (as shown in the screenshot).
Is there a way to avoid this annoying thick BORDER, please? - as shown in the following example:
Please, in order to see the problem:
(1)First click on button 1
(2)Second click on button 2
(3)Third click in any area outside the GUI
Example:
Code: Select all
#NoEnv
#Persistent
#SingleInstance Ignore
Gui, Margin , 0, 0
Gui, Add, Button, x10 y3 h18 w76 gchbox_3 vBut3, Button 1
Gui, Add, Button, x100 y3 h18 w76 gchbox_4 vBut4, Button 2
Gui, Font, s10
Gui, Add, Text , x10 y40 cLime , Please, in order to see the problem: `n-------------------------------------------- `n `n(1)First click on button 1 `n `n(2)Second click on button 2 `n `n(3)Third click in any area outside the GUI
Gui +Maxsize%A_ScreenWidth%x%A_ScreenHeight% +Minsize250x60
Gui, -0x30000 ; WS_MINIMIZEBOX := 0x20000, WS_MAXIMIZEBOX := 0x10000 ; no min and no max icons on top menu bar
Gui, color, c5d5d5d
Gui, Show ,w300 h300, My Sticky Notes
Return
chbox_3:
T3 := !T3
If (T3) ; or --> If T3 = 1
{
Gui, -Caption
OnMessage(0x84, "WM_NCHITTEST")
OnMessage(0x83, "WM_NCCALCSIZE")
Sleep 10
Gui, +0x30000 ; WS_MINIMIZEBOX := 0x20000, WS_MAXIMIZEBOX := 0x10000 ; add min and max icons on top menu bar
Gui, Show, , My Sticky Notes
}
Else
{
Gui, +Caption
OnMessage(0x84, "WM_NCHITTEST",0)
OnMessage(0x83, "WM_NCCALCSIZE",0)
Sleep 10
Gui, -0x30000 ; WS_MINIMIZEBOX := 0x20000, WS_MAXIMIZEBOX := 0x10000 ; no min and no max icons on top menu bar
Gui, Show, , My Sticky Notes
}
Return
chbox_4:
FreezeGui2 := !FreezeGui2
IfEqual,FreezeGui2,1
{
Gui, +Resize
Sleep 10
Gui, +0x30000 ; WS_MINIMIZEBOX := 0x20000, WS_MAXIMIZEBOX := 0x10000 ; add min and max icons on top menu bar
Gui, Show, , My Sticky Notes
}
Else
{
Gui, -Resize
Sleep 10
Gui, -0x30000 ; WS_MINIMIZEBOX := 0x20000, WS_MAXIMIZEBOX := 0x10000 ; no min and no max icons on top menu bar
Gui, Show, , My Sticky Notes
}
Return
GuiClose:
goto ExitAll
Return
ExitAll:
ExitApp
WM_NCCALCSIZE()
{
if A_Gui
return 0 ; Sizes the client area to fill the entire window.
}
; Redefine where the sizing borders are. This is necessary since
; returning 0 for WM_NCCALCSIZE effectively gives borders zero size.
WM_NCHITTEST(wParam, lParam)
{
static border_size = 6
if !A_Gui
return
WinGetPos, gX, gY, gW, gH
x := lParam<<48>>48, y := lParam<<32>>48
hit_left := x < gX+border_size
hit_right := x >= gX+gW-border_size
hit_top := y < gY+border_size
hit_bottom := y >= gY+gH-border_size
if hit_top
{
if hit_left
return 0xD
else if hit_right
return 0xE
else
return 0xC
}
else if hit_bottom
{
if hit_left
return 0x10
else if hit_right
return 0x11
else
return 0xF
}
else if hit_left
return 0xA
else if hit_right
return 0xB
; else let default hit-testing be done
}
Screenshot:
- image.png (155.53 KiB) Viewed 294 times