Solved

Using WinExec to launch a program

Posted on 1997-09-17
8
356 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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