What is +HwndGHwnd? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
stwilliams1460
Posts: 26
Joined: 04 Sep 2016, 09:47

What is +HwndGHwnd?

Post by stwilliams1460 » 30 Sep 2016, 21:49

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!

User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: What is +HwndGHwnd?  Topic is solved

Post by Masonjar13 » 30 Sep 2016, 22:01

+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.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build

User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: What is +HwndGHwnd?

Post by tidbit » 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"
rawr. fear me.
*poke*
Is it December 21, 2012 yet?

stwilliams1460
Posts: 26
Joined: 04 Sep 2016, 09:47

Re: What is +HwndGHwnd?

Post by stwilliams1460 » 01 Oct 2016, 15:29

Thanks!

Psyese
Posts: 3
Joined: 30 Jul 2021, 15:04

Re: What is +HwndGHwnd?

Post by Psyese » 01 Jul 2022, 07:10

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?

User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: What is +HwndGHwnd?

Post by boiler » 01 Jul 2022, 07:34

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%

User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: What is +HwndGHwnd?

Post by tidbit » 02 Jul 2022, 10:17

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
rawr. fear me.
*poke*
Is it December 21, 2012 yet?

Post Reply

Return to “Ask for Help (v1)”