1 Replies - 12609 Views - Last Post: 24 November 2012 - 01:36 PM

#1 codeprada   User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 963
  • View blog
  • Posts: 2,382
  • Joined: 15-February 11

How To Get The Control ID of .NET Applications

Posted 23 November 2012 - 10:52 AM

Hello DIC members, I can't for the life of me get the Control ID of a button from a sample application made in .NET. I've read something about .NET applications having a Automation (or something of the sort) ID. I'm assuming the ID is auto generated at start up as the name suggest and since it's actually a different ID each time. When I made a application in C I'm able to get the Control ID without any hassle. By the way I'm using WinSpy++ to get this information.

Is there any other way to get the ID of a control or is there a different approach to .NET applications?

Here is a screenshot to clear things up. Thanks in advance.
Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: How To Get The Control ID of .NET Applications

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5227
  • View blog
  • Posts: 14,010
  • Joined: 18-April 07

Re: How To Get The Control ID of .NET Applications

Posted 24 November 2012 - 01:36 PM

Here is an article you may find a bit useful (and another article featuring some code that it uses). Unless you are doing this automation and need to find the control ID through Windows itself, I have never really needed to reference the ControlID. Within .NET you can use control names and on occassion the .Handle Property of controls to get the handle to interact with the Win API.

But hopefully this helps you on your journey...


NativeMethods Class Code...


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1