Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Automation

Posted on 2003-03-25
2
Medium Priority
?
132 Views
Last Modified: 2010-04-04
How can I pass a file name (e.g. a.doc, a.htm, a.xls or a.htm) to a console application and open it with proper application ?

Andrew
0
Comment
Question by:andrewyu
2 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 120 total points
ID: 8204347
if you mean console application written with Delphi, then you can use ParamStr(1) to read parameters that has been called like:

MyConsole.exe "c:\my documents\first.doc"

In your console application add ShellApi to uses caluse and write this code to open that file with MS-Word or the default .doc application:


ShellExecute(nil, 'open', PChar(ParamStr(1)), nil, nil, sw_Normal);

I'm not sure about sw_Normal, may be sw_ShowNormal, also you can put numbers such as 0, 1, 2 instead of that constants.

Motaz
0
 

Author Comment

by:andrewyu
ID: 8204643
Thank you very much !

Andrew
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Integration Management Part 2
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question