Solved

Using WinExec to launch a program

Posted on 1997-09-17
8
354 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
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry it does'nt work.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
Comment Utility
try this:
shellexecute(handle,'open','c:\...\EditorProgram.Exe','c:\...\Myfile.txt','',sw_show);
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

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

Author Comment

by:rainbowsoftware
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for yor answer, I found the solution with Params.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now