Jump to content

GET ClassName CommandButton (FM20.dll)


Recommended Posts

Go >here and try that software.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I used this Code :

#include "CUIAutomation2.au3"

Opt( "MustDeclareVars", 1 )

Global $oUIAutomation

MainFunc()


Func MainFunc()

  Local $hWindow = WinGetHandle("Form1") ;("[CLASS:ThunderRT6FormDC]" )
  If Not $hWindow Then Return

  $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation )
  If Not IsObj( $oUIAutomation ) Then Return

  Local $pWindow
  ;$oUIAutomation.GetRootElement( $pWindow )             ; Desktop
  $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) ; Window
  If Not $pWindow Then Return

  Local $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement )
  If Not IsObj( $oWindow ) Then Return

  ;ListDescendants( $oWindow, 0, 1 ) ; Desktop
  ListDescendants( $oWindow, 0, 0 )  ; Window

EndFunc


Func ListDescendants( $oParent, $iLevel, $iLevels = 0 )

  If Not IsObj( $oParent ) Then Return
  If $iLevels And $iLevel = $iLevels Then Return

  Local $pRawWalker, $oRawWalker
  $oUIAutomation.RawViewWalker( $pRawWalker )
  $oRawWalker = ObjCreateInterface( $pRawWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker )

  Local $pUIElement, $oUIElement
  $oRawWalker.GetFirstChildElement( $oParent, $pUIElement )
  $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement )

  Local $sIndent = ""
  For $i = 0 To $iLevel - 1
    $sIndent &= "    "
  Next

  While IsObj( $oUIElement )
    ConsoleWrite( $sIndent & "Title     = " & _UIA_getPropertyValue( $oUIElement, $UIA_NamePropertyId ) & @CRLF & _
                  $sIndent & "Class     = " & _UIA_getPropertyValue( $oUIElement, $UIA_ClassNamePropertyId ) & @CRLF & _
                  $sIndent & "Ctrl type = " & _UIA_getPropertyValue( $oUIElement, $UIA_ControlTypePropertyId ) & @CRLF & _
                  $sIndent & "Ctrl name = " & _UIA_getPropertyValue( $oUIElement, $UIA_LocalizedControlTypePropertyId ) & @CRLF & _
                  $sIndent & "Selected  = " & _UIA_getPropertyValue( $oUIElement, $UIA_SelectionItemIsSelectedPropertyId ) & @CRLF & _
                  $sIndent & "Handle    = " & Hex( _UIA_getPropertyValue( $oUIElement, $UIA_NativeWindowHandlePropertyId ) ) & @CRLF & @CRLF )

    ListDescendants( $oUIElement, $iLevel + 1, $iLevels )

    $oRawWalker.GetNextSiblingElement( $oUIElement, $pUIElement )
    $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement )
  WEnd

EndFunc


Func _UIA_getPropertyValue( $obj, $id )
  Local $tVal
  $obj.GetCurrentPropertyValue( $id, $tVal )
  If Not IsArray( $tVal ) Then Return $tVal
  Local $tStr = $tVal[0]
  For $i = 1 To UBound( $tVal ) - 1
    $tStr &= "; " & $tVal[$i]
  Next
  Return $tStr
EndFunc

Result :

Title     = Command1
Class     = ThunderRT6CommandButton
Ctrl type = 50000
Ctrl name = Bouton
Selected  = False
Handle    = 01570602

Title     = 
Class     = ThunderRT6TextBox
Ctrl type = 50004
Ctrl name = Modifier
Selected  = False
Handle    = 0023064C

Title     = 
Class     = 
Ctrl type = 50037
Ctrl name = barre de titre
Selected  = False
Handle    = 00000000

    Title     = Système
    Class     = 
    Ctrl type = 50010
    Ctrl name = barre de menus
    Selected  = False
    Handle    = 00000000

        Title     = Système
        Class     = 
        Ctrl type = 50011
        Ctrl name = élément de menu
        Selected  = False
        Handle    = 00000000

    Title     = Réduire
    Class     = 
    Ctrl type = 50000
    Ctrl name = Bouton
    Selected  = False
    Handle    = 00000000

    Title     = Agrandir
    Class     = 
    Ctrl type = 50000
    Ctrl name = Bouton
    Selected  = False
    Handle    = 00000000

    Title     = Fermer
    Class     = 
    Ctrl type = 50000
    Ctrl name = Bouton
    Selected  = False
    Handle    = 00000000

:sweating:  But there is no get classname commandButton

http://support2.microsoft.com/kb/224305/en-us

Edited by GHOSTSKIKDA
[center]I LOVE ALGERIA .... ;-)[/center]
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Isn't "ThunderRT6CommandButton" (post 5, second line in Result box) the class name of the button?

Link to comment
Share on other sites

Jos, Shouldn't it be 1 year and 2 months? One can hardly blame the OP for being impatient.


I have downloaded TEST.rar and executed TEST.exe on my old XP. Now I understand. The Form1 GUI contains two buttons, two textboxes, a title bar, a system menu and the usual minimize, maximize and close buttons.

All controls except one textbox and one button are recognized by the code in post 4 (I can see, that's my code). And the question by the OP seems to be: Why is one textbox and one button not recognized? Because the programmer of the Form1 GUI has not added any code to the controls, that makes it possible to recognize the controls.

The only controls which can be recognized automatically for example by the "AutoIt Window Info" tool are the standard MicroSoft controls in ComCtl32.dll.

The controls in Form1 are not standard controls but Microsoft Forms 2.0 Controls. To be able to recognized such controls the programmer of the Form1 GUI must add code to the controls, that makes it possible to recognize the controls. He has not done, and the controls can not be recognized.

I've also tested with Inspect.exe from Windows SDK. It also does not recognize the controls at all. Neither in UI Automation mode nor in Accessibility mode.

Link to comment
Share on other sites

  • Developers
18 minutes ago, LarsJ said:

Jos, Shouldn't it be 1 year and 2 months? One can hardly blame the OP for being impatient.

Yea you are right :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

FM20.dll seems to have been distributed with Windows 95 or Office 97. It's 20 years old. VB6 is about 20 years old. The official MicroSoft support for all this software probably stopped 10 years ago. I don't think there is any guarantee at all that TestComplete is able to recognize the controls. I don't think the UI Automation team will consider it as a defect not to be able to recognize controls created with unsupported 20 years old software.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...