Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling another Application

Status
Not open for further replies.

DocHollywood

Programmer
Feb 2, 2004
2
US
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?

 

Welcome to TT DocHollywood, to get the most from this site please read FAQ222-2244.

With a combination of API you can accomplish this task. The first thing you will need is a handle to the window. You can get this by FindWindow or by EnumWindows. Then you will need to get the handles to each of the child windows you want to interact with and you can use EnumChildWindows for that. Then you can use SendMessage to send your text and dblclicks to each of the child windows.

Good Luck

 
Are these calls to the Windows API possible using .net? I've been searching for such functions in the MSDN and Microsoft Knowledge Base and haven't had luck finding them. For .net, but they are there for older versions of VB. Most of the articles in the Knowledge base are from circa 1995.

I've also been looking around at some books available for help on this topic and have found that there are several referencing the "lost capability" with .net; any word on that?

Can this be done through the .net Framework?
 

Yes, look up imports (I think that was it). There is a special way in which you can use the Win API. Meaning that you cannot use the typical declaration of the API, but you must use a special format to declare the API for use within .Net.

Good Luck

 
There's quite a bit of stuff on API in .NET at Allapi:


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 

DocHollywood, have you read FAQ222-2244 yet? Did you get it to work?

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top