Modify

Opened 6 years ago

Closed 4 years ago

#3627 closed Feature Request (Rejected)

Feature Request: AutoItWinGetHandle()

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: AutoItWinGetTitle AutoItWinSetTitle Cc:

Description

As simple as it sounds, can we get a function that just gives the handle to that hidden AutoIt window?
Then we can all stop using functions like this:

Func _AutoItWinGetHandle()
	Local $sOld = AutoItWinGetTitle()
	Local $sTmp = 'au3win' & Random()
	AutoItWinSetTitle($sTmp)
	Local $hWnd = WinGetHandle($sTmp)
	AutoItWinSetTitle($sOld)
	Return $hWnd
EndFunc;==>_AutoItWinGetHandle

Attachments (0)

Change History (6)

comment:1 Changed 6 years ago by Melba23

Why so complicated? Why not simply:

$hWnd = WinGetHandle(AutoItWinGetTitle())

M23

comment:2 Changed 6 years ago by therks

If you have more than one AutoIt process running you could end up with the handle for another process. Also because the default title is just "AutoIt v3" it's possible another (non-AutoIt) window with that title could be open as well.

comment:3 Changed 6 years ago by Melba23

Did you try to see if this was the case? When I run several concurrent instances of the same script I get a different handle returned for each instance, so it appears that the code will only return the handle associated with that instance, which is what I would expect.

M23

comment:4 Changed 6 years ago by therks

I suppose if that variable is set and used like a constant (at the beginning of a script launch), there would probably be no problems. But if the lookup for the window handle happens some time after launch (eg: from a UDF) when the calling process is not focused, it could return the incorrect handle.

For example, if you have a folder open titled "AutoIt v3" and your script calls WinGetHandle(AutoItWinGetTitle()) a few minutes after it was first launched, it will return the Explorer window.

Maybe it would even be more appropriate as a macro, like @AutoItWinHandle.

I guess it doesn't matter though as it seems I'm the only one interested.

comment:5 Changed 6 years ago by BrewManNH

What exactly do you need the handle of the hidden window for? In 8 years of using AutoIt, I don't think I've ever seen anyone that ever needed that information, so I'm curious as to why you think this is necessary.

comment:6 Changed 4 years ago by Melba23

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.