none
API get the name of the control running in different application

    Question

  • Can someone tell me how to get the name of control on the screen that is running in a different appliation. The getwindowname only gets the title bar and controls don't have title bars. I can get the text from each control , but I can seem to find a way to get the name of it. Please Help !!!

    Thanks Mark

     

    Tuesday, April 12, 2011 9:25 PM

Answers

  • Mark,

    there's only the classname or handle that you can get, a 'name' like you are refering to, is just a construction for programmers to write readable code. It is not present in the compiled exe. If it's .Net code, you can choose to have the debug info included when compiling, in that case you could get the name.

    Thursday, April 14, 2011 1:23 PM

All replies

  • hi,

    you could use the spy++ tool (in VS) to find that out

    Tuesday, April 12, 2011 9:31 PM
  • Nico,

     is there an API that will do it?

    Thanks Mark

     

     

     

    Tuesday, April 12, 2011 9:39 PM
  • try this. you need the window handle of the control first:

     

    Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As IntPtr, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Integer
    
    Dim aClass As String = New String(" "c, 128)
    Dim lRet As Integer = GetClassName(hHandle, aClass, 128)
    aClass = aClass.Substring(0, lRet)
     

     


    thanks for any help

     

    Wednesday, April 13, 2011 12:21 AM
  • Paul,

     Thanks for the reply but that only gives you the control class name not the name of the control itself.

    Thanks Mark

     

     

    Thursday, April 14, 2011 12:53 PM
  • Mark,

    there's only the classname or handle that you can get, a 'name' like you are refering to, is just a construction for programmers to write readable code. It is not present in the compiled exe. If it's .Net code, you can choose to have the debug info included when compiling, in that case you could get the name.

    Thursday, April 14, 2011 1:23 PM
  • Nico,

    Ok Thanks that explains explains why I can't find anything that would work. I am looking at other applications running and trying to extract information and I figure that programmers name would have been attach with the control but all it gets is the control class name.

    Thanks Mark

     

     

    Thursday, April 14, 2011 1:32 PM