Controlling another application

DocHollywood
02-02-2004, 09:33 AM
Hey All,

I'm writing an application which will take data from an Excel Spreadsheet and enter it into an existing application which I did not develop and do not have access to the source code. I do know that the application was written in Visual Basic 6 though, so hopefully that will help a bit.

I however and developing in VB.net

What I would like is to somewhat take control of the external application (TCG) and input data into fields on the form. Nearly all fields are MSflexgrid's, but some fields do require a double-click to activate a hidden combobox.

I have considered sending Keystrokes to TCG, but this is a very unstable method.


Is there any way I can take control of the program using API or another method to directly access data fields or objects even though TCG was not written for communication purposes?

Mike Rosenblum
02-02-2004, 02:37 PM
Hey Doc,

(I love the Username btw.)

I don't know about controlling TCG here. I'm guessing that SendKeys might be the best that one can do with this, but I'm not an expert on that. Hopefully someone will happen by that is better at this than I.

Hopefully the degree to which you wish to Automate/Control Excel is not too extensive. OLE Automation using .Net is technically feasible and I wrote a Tutorial on the process, but as a practical matter I find it, well, pretty impractical.

Using VB6 to Automate/control Excel is 100x easier and far less mistake prone. MSFT did their best to make .Net backwards compatible with COM using what they call the 'COM Interop', but it really is extremely finicky to use.

At a minimum, I would get a sense of it by reading the Tutorial here:
VB.Net Office Integration FAQ (http://www.visualbasicforum.com/t129690.html) as well as some of the other threads on this sub-forum, including here: 610020.

I hope this helps, but I also hope that someone will come by with some more ideas about how to control TCG... I just don't know of any way besides SendKeys either...

-- Mike

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum