Importing from external application

Megalith

Well-known member
Joined
Aug 21, 2006
Messages
66
Programming Experience
10+
I am writing an application that needs to analyse an existing application and to react with 'Alarms' as certain values are reached. The application in question isn't written by me and is in an exe format.

Essentially what i need to do is to attach my program to this application and to read text values from from various locations within its form. This is entirely new to me and i am thinking some form of character recognition would be the solution.

Maybe someone here knows another way to access this data? or how to do this with character recognition. All my application will do is react when certain user defined limits are reached.:eek:
 
somehow this is in the wrong thread :( can someone in admin remove it i have copied it into a more suitable thread
 
Its in the wrong forum because thats where you first posted it, i deleted your other duplicate thread. Assuming then that this is not a console application related topic? i'll move it to a more appropriate forum.
 
Yeah it is more a general question true, the application i want to monitor is a signal monitoring program for a programmable stepper motor, over time the load can vary and this is displayed along with the drive voltage (and some other less important statistics)

My application needs to monitor these values and send out an audible alarm when certain thresholds are exceeded. After analysing the problem it would appear that the simplest solution would be to read the contents of the external application but this is beyond my current technical abilities.

Is it possible to 'read' the contents of a textbox in another compiled application? If not is it possible to say copy the contents of the screen at the location of this textbox, within this program (or the entire window occupied by this software even)?

Any help as a starting point would be greatly appreciated as would any links to information on using VB to capture parts of a screen occupied by an external application.
 
When interacting with external applications like this you need to invoke the Windows API. The Windows API consists of all the functions exported from the C libraries that Windows is built on. Accessing those functions directly was how all Windows programming used to be done, but now we have much friendlier layers like the .NET Framework to shield us from that stuff. There times when the Framework just can't do what you need though, and then it's time to resort to the Windows API. Unfortunately the documentation for the Windows API is not quite as orderly as it is for the .NET Framework and it is geared towards C/C++ developers. There are lot's of tools and third-party documentation around to help though. I'd suggest starting here: http://www.allapi.net/
 
Ok i've tried the sample code and application to open and close regsvr32 but i get an error message that i have since determined to be a compatability issue as the code was written for VB6 and i use VB.NET 2005 i do have a copy of VB6 lurking somewhere but i would prefer to be able to complete this application using .NET :( any suggestions?
 
It was written for .Net as it says, but there is a typo in the GetWindow declaration, the wCmd parameter now Long should've been Integer. Else it at first glance looks right. So long! :)
 
Great thanks JohnH thats taken care of that :) i now tho have a null reference error :( should be able to get to the bottom of it tho as im now dealing with VB and not API as such. :confused:
 
Back
Top