Page 1 of 1

What is +HwndGHwnd?

Posted: 30 Sep 2016, 21:49
by stwilliams1460
It's actually in response to an answer on another post, but since it's a different question, it seemed fitting.

I see a ton of examples of it being used, but I'm not exactly sure what it's doing.

Thanks!

Re: What is +HwndGHwnd?  Topic is solved

Posted: 30 Sep 2016, 22:01
by Masonjar13
+hwnd is an option for a gui, it says to add the hwnd (window handle) of the gui to the specified variable. The specified variable is denoted immediately after the option: +hwndvar. ghwnd is short for guihwnd. Easy to remember, in my opinion.

Re: What is +HwndGHwnd?

Posted: 01 Oct 2016, 11:07
by tidbit
I usually use +hwndMYHWND (and keep adding numbers/names for each other gui, like +hwndMYHWNDSettings or +hwndMYHWND2)
"My" basically means "my gui's HWND, not some other programs gui"

Re: What is +HwndGHwnd?

Posted: 01 Oct 2016, 15:29
by stwilliams1460
Thanks!

Re: What is +HwndGHwnd?

Posted: 01 Jul 2022, 07:10
by Psyese
tidbit wrote:
01 Oct 2016, 11:07
I usually use +hwndMYHWND (and keep adding numbers/names for each other gui, like +hwndMYHWNDSettings or +hwndMYHWND2)
"My" basically means "my gui's HWND, not some other programs gui"
How did you come to decide to do that? What problem did it solve for you?

Re: What is +HwndGHwnd?

Posted: 01 Jul 2022, 07:34
by boiler
Sometimes you need to know the hwnd of your GUI window so you can refer to it with commands where you need to specify the window, such as making the GUI semi-transparent:

Code: Select all

WinSet, Transparent, 150, ahk_id %MYHWND%

Re: What is +HwndGHwnd?

Posted: 02 Jul 2022, 10:17
by tidbit
basically what he said.

use "my" to clearly indicate that it's MY gui/window/program/script, not some other app or control. Controls can have hwnds too, but I only use this layout for the windows itself.

use "hwnd" to indicate that its a unique id/handle/pointer to the window, not its title or other.

use "name or number" if I'll have multiple myhwnd vars. if it's a simple script, might get lazy and do myhwnd1/2/3 or if I'm not lazy and want clarity myhwndMain/Settings/Whatever