Solved

Using WinExec to launch a program

Posted on 1997-09-17
8
360 Views
Last Modified: 2010-04-04
How do I open an editor with a specific textfile loaded.
I have tried
WinExec('EditorProgram.Exe, Myfile.txt', SW_SHOW);
but it does'nt work.
0
Comment
Question by:rainbowsoftware
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345325
mayby remove comma ? and try :
WinExec('EditorProgram.Exe Myfile.txt', SW_SHOW);
and of course you must insert all with full path name.

WinExec('c:\tmp\EditorProgram.Exe c:\doc\Myfile.txt', SW_SHOW);
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1345326
try this:

uses shellapi;
.
.
shellexecute(handle,'open','c:\doc\Myfile.txt','','',sw_show);

this will open the text file by the editor program associated with the text file.
0
 

Author Comment

by:rainbowsoftware
ID: 1345327
Sorry it does'nt work.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1345328
try this:
shellexecute(handle,'open','c:\...\EditorProgram.Exe','c:\...\Myfile.txt','',sw_show);
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345329
What program you try running ? and
WinExec is a function What is the result ?
0
 

Author Comment

by:rainbowsoftware
ID: 1345330
I have created my own Editor and try to open a textfile in my editor.
And I have also been trying to open a file in the Delphi Demo program Richedit,
but didn't succeed ( Richedit application is a Demo on the Delphi 2 CD)

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1345331
Do you'r program parsing Parameters ?

example :
for i:=0 to ParamCount do
  st := ParamStr(i);

You must do this.

The Simples way is to place in OnShow of MainForm the code to load file which have name = ParamStr(1)

You probably have a function for load file so you must call them with ParamStr(1).
0
 

Author Comment

by:rainbowsoftware
ID: 1345332
Thanks for yor answer, I found the solution with Params.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to open a new windows chrome resized and disabled the toolbar? 3 229
Magic Software info 18 154
Multiple image collision 13 106
IP without any Dots 1 99
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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