Delphi, read data from 3rd party data field - delphi

I am writing an application that needs to read a data field on another Delphi program and I do not have access to the source code of the 3rd party program. The data field contains the "foreign key" to a record I need to retrieve or create in my application.
I would appreciate any links to knowledge or components that will help me with my program.

I'm assuming that you are trying to "screen scrape" a text field from another app. You can use FindWindow to get a handle that that window, then dig through the child windows to find the control that you're looking for (WinDowse by Greatis will be very helpful here for exploring manually). Finally, send a WM_GetText message to the control that has the data. Here is an example of how to do this: About.Com article on digging and scraping with Internet Explorer.
Edit: D'oh! WM_GetText is already wrapped in the VCL with the GetWindowText function defined in windows.pas. ex:
GetWindowText(Wnd, PC, sizeof(PC));

Related

Using WinAppDriver to automate TcxVerticalGrid

I'm trying to automate a WinForms application that contains a TcXVerticalGrid control. I'm able to access the control using the FindElementByXPath method, but I cannot figure out how to get access to the rows within the component. The component is used like a property grid, where each row has a property name in the left column and an editable value in the right column. I'm trying to figure out how to move the the correct row based on the property name, and then edit the corresponding property value.
I've tried using WinAppDriverUIRecorder.exe tool as well as Inspect.exe, neither of which were able to provide much insight. I've searched Developer Express for answers, but I wasn't able to find anything. One blog post said that they had no plans to support Microsoft's UI Automation api, while another said that they did support WinAppDriver. I'm not sure what technology Appium uses to access Windows controls, but it seems like Developer Express components might not support that technology.
I don't have much experience with Appium or WinAppDriver, so any advice would be helpful. I am able to automate the application with TestComplete, however, it's only possible with their Open Application technology. I've also tried FlaUI, but I wasn't able to get that to work with this component either.
Is it possible to automate this component with Appium, or should I look for a different technology?

Getting autocomplete googleMaps data into a Delphi combobox

I am doing a Delphi transport application interacting with GoogleMaps APi and i would like to propose all "near by" names coming from the autocomplete Google Maps API when i enter the starting adress of the direction.
All of this will be displayed in a TCombobox when would be changed on the OnChange propertie.
Is that possible ??? ever heard of it ???
Thanks a lot
Gwenael
There is a part of the Google Maps API called The Google Places Autocomplete API. You can send requests (in the examples part of the reference page there is also the example with bounds for your purpose) as you will type in your combo box (ideally after some short delay for typos corrections). As the result you can receive either JSON or XML format file. After you parse it, you will get the list of appropriate suggestions.
I'm not sure with the Google Maps API Key; if it's possible to use it in standalone application (and about the limitations) because I haven't implemented static part of the Google Maps yet.
My first thought (assuming an approach which is based on remote controlling the web interface) was: this can be solved using TWebBrowser and friends (IWebBrowser2, IHTMLElement etc.). See my answer on this question to get a feeling for this. You could use Embedded Web Browser from bsalsa for easy access to all the Internet Explorer functionality.
My second thought was: there might be a part in the official API for this. But this I don't know. If there is none then the above approach could be a (work-intensive) workaround.
Yes, it's possible.
I have written a free and open source component that implements the Google Place Autocomplete and Google Place Details API's:
https://carbonsoft.co.za/components/
or
https://github.com/RynoCoetzee/TRCGPlaceAutoCompleteCombo

fill html input field and tedit same time

I want to create a form with a twebbrowser and a tedit box, more if needed.
Then lets say, I want the browser to be on google.com and when I type in the search bar I want it to type in the tedit as well. Best would be at the same time but it is fine if i click away it will fill in the tedit box as well. i just want to understand how this work, Type on the site and have the edit boxed automatically typed as well.
anyone can help me?
There is no event in TWebBrowser (so far as I know) that fires as you edit the location (I don't think TWebBrowser has a search bar so I presume that's what you mean).
When I have tried to keep a host app in sync with a TWebBrowser I have used the OnBeforeNavigate2 event.
I haven't tried this, but I bookmarked the web site a while ago.
Calling into Delphi from JavaScript
The article discusses how to call delphi-code from the TWebBrowser. You implements an external object extension by declaring an interface, and then registers it with the browser control. Doing that, you should be able to invoke delphi methods by using JavaScript in the web site.
You have to be in control of the source that is shown in the TWebBrowser, so the google example wouldn't work. ...unless you manipulate the html-source by injecting custom code before you show it in the TWebBrowser, of cource.
I hope this may put you the right track...
Reading your comment, you may consider to do it the other way around:
Type the search in the TEdit (and handle all the logging you need), and then navigate the TWebBrowser to this url: 'http://www.google.com/search?q=' + Edit1.Text

Controlling the mail client from delphi

I have an issue here where we need to control outlook from Embarcadero Delphi 2010.
we used today some thirdparty components for opening the mail sending window, this worked some timeago. but now it seem to fail on newer outlook versions.
are there any component out there dedicated to controlling outlook from Delphi, or are there any MAPI clients that can work as a better replacement for this.
what we need to do basically is to:
1. Start new message in outlook (sending recipient as parameter)
2. receive the sent message so we can store it
3. drag and drop messages from outlook to our application.
if the enduser do not use outlook, a normal MAPI would suffice as replacement.
where do I find a good robust component for doing such job for me ?
For the first two steps regular OLE automation using the Outlook2000.pas unit that comes bundled with Delphi should work fine though you might want to take a look at Dmitry Streblechenko's Redemption library: http://dimastr.com/redemption/ which simplifies many of the more low-level (Extended-)MAPI tasks significantly.
For intercepting the sent message you should create an instance of TItems and connect it to the folder reference you could get from OutlookApplication.Session.GetDefaultFolder(olFolderSentMail). You can then assign an event handler to its OnItemAdd event.
For drag & drop from Outlook into your application you can take a look at Anders Melanders excellent (and free) Drag&Drop library (includes examples for interacting with Outlook): http://melander.dk/delphi/dragdrop/
I've used these components a long time ago and they were fantastic
http://www.add-in-express.com/add-in-delphi/
Here are some features for Outlook
http://www.add-in-express.com/add-in-delphi/programming-outlook.php

How to embed HTML help in a form window

I'm wondering if it is possible to display topics from a CHM help file in a form of my Delphi application? I know how to use the htmlhelp api but it launches the external help viewer. I would like to display the help topics within a form
Not tested, but...
If you pass the help url (like ms-help://embarcadero.rs2009/delphivclwin32/System__TDateTime__-#TDateTime_#const.html) to an embedded WebBrowser, it should work.
Another solution in case you don't want to use MSIE, could be to port the chm reader library from Free Pascal. It is written in the Delphi dialect, and should be fairly easily, and allows you to extract HTMLs from the CHM (and compress back if necesary) without additional external dlls.

Resources