[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using WinExec to launch a program

Posted on 1997-09-17
8
Medium Priority
?
363 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 5

Accepted Solution

by:
ronit051397 earned 100 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

656 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