AutoHotkey Community

It is currently May 27th, 2012, 6:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: September 22nd, 2011, 9:42 am 
Offline

Joined: February 27th, 2006, 5:55 pm
Posts: 24
Location: Italy
Hi.

Is there a possibility to retrieve the HWND of an EDIT Control in a GUI? (Not the window handle HWND)

Code:
    Gui, 1:Add, Edit,     x044   y020  w020  h020 vFile1 HWNDhedit1                               
    Gui, 1:Add, Edit,     x044   y040  w020  h020 vFile2 HWNDhedit2     
 


For example, what can I do to get the %hedit1% of File1 control?

Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2011, 3:08 pm 
Offline

Joined: July 6th, 2011, 5:37 pm
Posts: 214
Location: Looking over my domain
Gui -> Controls: Uncommon Styles and Options wrote:
HwndOutputVar [v1.0.46.01+]: When used with Gui Add, this option stores the window handle (HWND) of the newly created control in OutputVar. For example: Gui, Add, Edit, vMyEdit HwndMyEditHwnd. When within a function, MyEditHwnd is treated as a function dynamic variable. A control's HWND is often used with PostMessage, SendMessage, and DllCall. It can also be used directly as an ahk_id WinTitle (this also works on hidden controls even when DetectHiddenWindows is Off) or [in v1.1.04+] with GuiControl and GuiControlGet as the ControlID parameter. On a related note, a parent window's HWND can be retrieved via Gui MyGui:+HwndOutputVar.

psst you really need to read the actual documentation
Code:
Gui, Add, Edit, vMyEdit HwndMyEditHwnd
MsgBox,% MyEditHwnd

_________________
Image Stolen from SKAN


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 23rd, 2011, 2:22 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Wdb wrote:
For example, what can I do to get the %hedit1% of File1 control?
You've already got it. Just use it.
Code:
MsgBox % hedit1


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 23rd, 2011, 6:12 pm 
Offline

Joined: February 27th, 2006, 5:55 pm
Posts: 24
Location: Italy
Yes, of course.

But if I don't know that is %hedit1% ?
If I only know control name "File1" ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2011, 6:45 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
ControlGet and GuiControlGet can give you the HWND of a control. The Gui version is for Guis you make, the other is for other programs' controls.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2011, 7:20 pm 
Offline

Joined: February 27th, 2006, 5:55 pm
Posts: 24
Location: Italy
Code:
Gui, 1:Add, Edit,     x044   y020  w020  h020 vFile1 HWNDhedit1                               
Gui, 1:Add, Edit,     x044   y040  w020  h020 vFile2 HWNDhedit2

Thanks all!

I was in wrong!
The statement
Code:
GuiControlGet, Wdb_HWND, Hwnd, File1

returns right the handle control (not the window handle).

:D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: migz99, sjc1000 and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group