Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Keystrokes for non-windows applications


Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2005, 09:48 PM
ogopogo ogopogo is offline
Newcomer
 
Join Date: Dec 2004
Posts: 10
Default Keystrokes for non-windows applications


Hello,

I'm having some trouble running an external DOS based application from my code. I'm using shell to start the application which works fine, however I need the application to be maximised, or else it runs very slowly, and this cannot be done until the program has fully loaded or it gets squished into the top half of the screen.

I'm using the following code the start the application. Normally when running this application you need to press ALT+ENTER to maximise it however in this code the sendkeys command does not work, instead the program just beeps.

Code:
Shell "G:\SC7\MODULES\CATI\SAMPREP.BAT", 1 ' start application Application.Wait (Now + TimeValue("0:00:10")) 'wait for application to load SendKeys "%~" 'trying to maximise once application has loaded

I now know, reading help, that sendkeys cannot be used for external applications not designed for windows, is there anything else I can do to maximise this application?
Reply With Quote
  #2  
Old 04-12-2005, 02:00 PM
NateO's Avatar
NateO NateO is offline
Excellent…

Forum Leader
* Expert *
 
Join Date: Jun 2004
Location: Minneapolis MN - deceased
Posts: 2,483
Default

Bonjour,

Try the following:

Code:
SendKeys "%~" Shell "G:\SC7\MODULES\CATI\SAMPREP.BAT", 1
Obviously untested on my part, I'll leave that to you.
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Reply With Quote
  #3  
Old 04-12-2005, 04:41 PM
ogopogo ogopogo is offline
Newcomer
 
Join Date: Dec 2004
Posts: 10
Default

Hello,

Unfortunately this still does work. I don't think Sendkeys is going to work with the DOS application as in VBA help it says:
"Note You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows or Macintosh."
And this is a DOS based application.

But thanks for your help, any other ideas?

Cheers
Reply With Quote
  #4  
Old 04-13-2005, 09:27 AM
Timbo's Avatar
Timbo Timbo is offline
Green-Eyed

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261
Default

Here's an article:
http://www.cpcug.org/user/clemenzi/t...OSSendKeys.htm

and an old solution:
http://www.planet-source-code.com/vb...d=749&lngWId=1

There may be more recent alternatives around, though I suspect they will simply use newer API functions.
__________________
"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote
  #5  
Old 04-24-2005, 05:22 AM
ogopogo ogopogo is offline
Newcomer
 
Join Date: Dec 2004
Posts: 10
Default

So sorry for not replying earlier, have been very busy and sick.

Thanks for all your help Timbo, I haven't yet had a chance to test it but I'm sure it'll do the job.

Thanks again
Cheers
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->