Jump to content
Sign in to follow this  
r4bbit

AutoIt and Delphi apps

Recommended Posts

r4bbit

Hi,

I'm new to AutoIt, and I'm trying to use it together with a Delphi app.

The app is actually an installer which can be downloaded here:

http://www.freenew.net/windows/skype/68644/download.htm

I want to write a script which automatically skips all offers.

The problem is that its buttons (next and skip) do not have corresponding window handles.

Here is a screenshot of the installer and WinSpy++:

'>

All I need is to find out the rectangle of the buttons.

Is there any alternative way to handle such Delphi GUIs?

P.S. When I open the file in a resource editor, I can see all those controls.

It seems like Delphi draws them manually instead of relying on Windows API controls.

Thanks in advance for any help.

Share this post


Link to post
Share on other sites
MilesAhead

Is this a third party Delphi program?  I am asking because with Delphi vcl programs the main Window is not the window that handles the message loop.  It is usually TForm1 of type TForm.  You may be able to get the form's parent window handle, then enumerate all children.  But it will likely require quite a bit of trial and error.

Instead of getting the button handles it may be simpler just to send Tab until the button you want has focus.  Then send Enter.

Share this post


Link to post
Share on other sites
r4bbit

Yes, it's a third party program.

As you can see on the screenshot, there are no other parent windows with children.

The application draws the controls manually.

Instead of getting the button handles it may be simpler just to send Tab until the button you want has focus.  Then send Enter.

 

Unfortunately, this is not an acceptable solution. It's too unreliable for my needs.

Share this post


Link to post
Share on other sites
mLipok

off topic:

haha...

awesome avatar 5*

Regards

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
DonnyF

In agreement with Miles. VCL can create components on the fly from code (during run-time), but in the end, everything in windows has a handle. You can get the handle of the main form (by title is probably the easiest), and then enumerate the child components (this does not mean child windows, but any component on a form - be it a button, combobox, raidio, etc - is a child component that will have a handle.) If you return the values from the WinAPI, the text of the button that you are looking for should be included. Run a quick enumeration program that stores all child enums in a ListBox or a Memo, and you will be able to grab what you need. The only time it may not return the desired results, would be when the component/button you're trying to get to is in something like a menu. But you should still be able to come up with a quick way to bring up the window using WinWaitActive() or something similar, and then send over a click to the correct X,Y location. If you write an enumration program in Delphi, it's pretty simple to grab what you need from another Delphi program ... or any program for that matter (You may even find buttons that were marked as notVisible from the "sneaky" VB'ers out there). From the info you get, you can convert that over to the language you need (vb, C#, autit, etc).

Cheers,

---D

Share this post


Link to post
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
Sign in to follow this  

×