Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Window styles


  • Please log in to reply
7 replies to this topic
Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004
Does anyone know if there is a way of setting the window style that has just a close button and the question mark in the top right hand corner?

Im sure i saw it somewhere, but now I can't find it.
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle

Helpy
  • Guests
  • Last active:
  • Joined: --
Search WinSet Style

Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004

Sorry, should have been more specific, I know the command. I just cannot find the actual style itself.

I must of read through the styles page five times now, and rendomly tried a few too.

As a secondary note, it's a gui window i'm creating so im not using winset

Just

Gui , +/- Style


Ok I found it its

WS_EX_CONTEXTHELP  0x00000400  Includes a question mark in the title bar of the window. Cannot be used with the WS_MAXIMIZEBOX or WS_MINIMIZEBOX

Got it working :D
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle

Helpy
  • Guests
  • Last active:
  • Joined: --
Ah, OK.
The best I could do is:
Gui -MaximizeBox -MinimizeBox
Gui Add, Text, , Testing GUI
Gui Add, Button, gGuiClose, Close
Gui Show, w400 h300
Return

GuiClose:
GuiEscape:
	ExitApp
If you remove the SysMenu, you remove the Close button as well, I don't know if you can separate them. Windows with only the Close button are dialog boxes, AFAIK, they are different from AHK GUI windows.

Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004
gui -MinimizeBox +E0x00000400

For future reference will create the required looking box.


<!-- m -->http://www.autohotke... ... 3&start=15<!-- m -->

This is docemented here with a working script to monitor the wm_help messages too.

I think it might be worth adding this style to the manual though.
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle

Helpy
  • Guests
  • Last active:
  • Joined: --
I missed your update, your main concern was with the Help button, not the sys menu...
Thanks for giving the solution, this sure can be useful.
Chris doesn't provide much advanced styles in the manual, but this one can be useful indeed.

It would be nice to provide a simple full working example of use of the style and the message, if possible.

Superfraggle
  • Members
  • 1019 posts
  • Last active: Sep 25 2011 01:06 AM
  • Joined: 02 Nov 2004
Thought I would post a working example. Not very elegant, but it paints the rough picture.

gui add,button,Hwndok,OK
gui add,button,Hwndsad,Sad
gui add,button,Hwndclose,Close
gui -MinimizeBox +E0x00000400
Gui show,
onmessage(0x0053, "displayhelp")
%OK%_HELP:="Click this button if you are feeling ok today.`nDon't forget though, only click this button if you are"
%SAD%_HELP:="Click this button if you are feeling sad.`nPerhaps you need cheering up.`n Perhaps you are just bored"
%CLOSE%_HELP:="Click this button to close this tiny application"
return

buttonok:
Msgbox OK
return

buttonsad:
Msgbox Sad
return

buttonClose:
Exitapp
return

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

displayhelp() 
   { 
   mousegetpos,,,,name,2
   tooltip % %name%_HELP
   SetTimer, RemoveToolTip, 5000
   }

I know we can also use the other help of moving the mouse over the control, but sometimes you might want a small tooltip for that, and a more descriptive tooltip for doing it this way. Or you could link directly to your help file.
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I saw this interesting topic, so I tried to implement it, following the classical way...
Gui -MaximizeBox -MinimizeBox +E0x00000400
Gui Add, Text, Hwndt1, Testing GUI
Gui Add, Button, gGuiClose HWndb1, Close
Gui Show, w400 h300

OnMessage(0x53, "WM_HELP")
Return

GuiClose:
GuiEscape:
	ExitApp

WM_HELP(_notUsed, _lphi, _msg, _hwndControl)
{
	global

	iCtrlID := GetInteger(_lphi, 8)
	hItemHandle := GetInteger(_lphi, 12)
	dwContextId := GetInteger(_lphi, 16)
	x := GetInteger(_lphi, 20)
	y := GetInteger(_lphi, 24)
;~ 	MsgBox ID: %iCtrlID% h: %hItemHandle% Ctx: %dwContextId% (%x% %y%)
	If (hItemHandle = t1)
		ToolTip Plain old label
	Else If (hItemHandle = b1)
		ToolTip The Close button, to close the window!
	Else
		ToolTip Unknown element
	SetTimer GoOff, -1500
}

GoOff:
	ToolTip
Return

GetInteger(_sourceAddr, _offset = 0, _size = 4, _bIsSigned = false)
{
	local result

	Loop %_size%  ; Build the integer by adding up its bytes.
	{
		result += *(_sourceAddr + _offset + A_Index-1) << 8*(A_Index-1)
	}
	If (!_bIsSigned OR _size > 4 OR result < 0x80000000)
		Return result  ; Signed vs. unsigned doesn't matter in these cases.
	; Otherwise, convert the value (now known to be 32-bit & negative) to its signed counterpart:
	return -(0xFFFFFFFF - result + 1)
}
/*
typedef struct tagHELPINFO {
    UINT cbSize;           0
    int iContextType;      4
    int iCtrlId;           8
    HANDLE hItemHandle;    12
    DWORD dwContextId;     16
    POINT MousePos;        20 & 24
} HELPINFO, *LPHELPINFO;
*/
Our codes are close, you just used resources provided by AHK instead of parsing a binary structure...
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")