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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation without OLE 1

Status
Not open for further replies.

turtlemaster

Programmer
Oct 4, 2001
93
US
I have this application that opens a word document to generate a report. I need to automate a task in the application upon the closing of the word document but the application does not support OLE automation (I can't even get a reference to the darn thing). I was thinking that I may be able to use API calls. I guess what I need to do is;

1.) Get a reference to an application already running in memory.
2.) Force that application to run a function. (Press a button and open a window).

I tried sendkeys but the button has no shortcut key and I don't know how to the application keys directly anyway (without alt+tabing over and then I can't be sure that I am going to the right application)
 

Check out the following API's...

SendMessage
GetWindow
EnumWindows
GetWindowInfo
GetWindowText
EnumChildWindows

You should be able to control another application with these (and a couple more) API's.

Good Luck

 
I am looking at the documentation but I can't seem to find a demo on how to use EnumWindows in VB. I am having a little difficulty understanding how the actual function works. I have found what windows object to send the message to using Spy++ but I can't get a handle to the window (or button) that I want to send the message to. Do you have any other resources that could help me.
 

Search this site for these API's and you will find a few (incomplete for your needs) examples. Also take a browse through the samples at msdn. Other places to look would be the programming groups at google or yahoo. There are some excelent sites that have good example code (allapi.net maybe). I know other people here have thier preferred sites that they like to go to (planet-source-code, thescarms etc.)Also Dan Appleman's API book is a decent reference.

Good Luck

 
I got it!!!!

Thanks-you so much for your help. Once I started expiriementing with the API calls and using SPY++ it was pretty easy to get it to work. You have opened a whole new world up of API for me and I can't thank you enough.

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top