Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Wed, 20 Aug 2008 17:59:41 +0100,    group: microsoft.public.win32.programmer.ui        back       


GetWindowLongPtr(hwnd, GWL_ID); and .net forms   
Hello All,

I have a tester appliaction that tests our MFC application by pushing
buttons and filling editboxes, etc. automatically. It  identifies the
control windows by the control id, that can be retrieved by
GetWindowLongPtr(hwnd, GWL_ID);

Our application also has a complicated .net dialog written in vb.net. When I
tried to implement some testcases for this dialog, I found out (to my
amazement) that the control ids of the .net controls become different when 
the
dialog gets destroyed and created again. Now my question is:

Is there a reliable way how I could find the HWND of a .NET control using
win32 calls?

For buttons it is ok, they have unique windownames (that is the label on
them), so I do not strictly need the ctrl id. But the windowname of an
editbox is its content, that is not unique on this complicated dialog.

I do have access to the vb.net code, so I can do modifications if that can
help my situation, but I do not want e.g. a COM interface that returns the 
HWND
for the requested control, I hope there is a solution more elegant than
that.

Do you have any sugestions other than the COM interface or to find a control 
by its position?

Thank you!!

Best regards,
Jozsi
date: Wed, 20 Aug 2008 17:59:41 +0100   author:   Jozsef Bekes

Re: GetWindowLongPtr(hwnd, GWL_ID); and .net forms   
"Jozsef Bekes" wrote:
> I do have access to the vb.net code, so I can do modifications 
> if that can help my situation, but I do not want e.g. a COM 
> interface that returns the HWND for the requested control, I 
> hope there is a solution more elegant than that.
>
> Do you have any sugestions other than the COM interface or to 
> find a control by its position?

You can fill "AccessibleName" property with unique ID string for a 
given control. Then, from the tester application call 
`AccessibleObjectFromWindow' in order to obtain `IAccessible' 
interface for the control. Use the `IAccessible::get_accName' 
method to identify your control.

HTH
Alex
date: Wed, 20 Aug 2008 20:55:13 +0300   author:   Alex Blekhman

Re: GetWindowLongPtr(hwnd, GWL_ID); and .net forms   
Hi Alex,

Thank you for your answer. I think I'd rather set the ctrl id from code if I 
need to prepare my vb.net controls for the tester.

I find it really strange that there is no better way. How do the automated 
test applicatiosn work on .net forms? I do not think that I am the first one 
who wants to implement something like this...

Thank you anyway!!!

Jozsi


"Alex Blekhman"  wrote in message 
news:Of7Pn3uAJHA.4372@TK2MSFTNGP05.phx.gbl...
> "Jozsef Bekes" wrote:
>> I do have access to the vb.net code, so I can do modifications if that 
>> can help my situation, but I do not want e.g. a COM interface that 
>> returns the HWND for the requested control, I hope there is a solution 
>> more elegant than that.
>>
>> Do you have any sugestions other than the COM interface or to find a 
>> control by its position?
>
> You can fill "AccessibleName" property with unique ID string for a given 
> control. Then, from the tester application call 
> `AccessibleObjectFromWindow' in order to obtain `IAccessible' interface 
> for the control. Use the `IAccessible::get_accName' method to identify 
> your control.
>
> HTH
> Alex
>
date: Thu, 21 Aug 2008 18:15:20 +0100   author:   Jozsef Bekes

Re: GetWindowLongPtr(hwnd, GWL_ID); and .net forms   
"Jozsef Bekes" wrote:
> I find it really strange that there is no better way. How do the 
> automated test applicatiosn work on .net forms? I do not think 
> that I am the first one who wants to implement something like 
> this...

I think they add additional info about the control, like label, 
position, etc. and calculate unique hash for the control. However, 
many testing tools use Accessibility techniques for GUI 
automation. It is reliable uniform way to control GUI. All 
Microsoft products support Active Accessibility pretty good.

Alex
date: Fri, 22 Aug 2008 00:13:57 +0300   author:   Alex Blekhman

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us