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

x
?
Solved

keep DOS window open

Posted on 2003-03-25
4
Medium Priority
?
228 Views
Last Modified: 2010-04-04
I'm using the following code to open a DOS application (test.exe)

ShellExecute(Handle,NIL,PChar('test.exe'),PChar(param1),nil,SW_SHOWNORMAL);

the problem is that the window closes right after it finishes, so I can't see the last message.
How do I keep the DOS window open without modifying test.exe?
I'm running Windows XP

PS. I am a beginner in Delphi, pls don't post complicated solution :)
0
Comment
Question by:Hardi
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
defy_boy earned 200 total points
ID: 8207674
like this


ShellExecute(Handle,NIL,PChar('command /k test.exe'),PChar(param1),nil,SW_SHOWNORMAL);

command.com is the dos window, /k keeps it open
0
 
LVL 6

Author Comment

by:Hardi
ID: 8208044
didn't work, it seems that shellexecute cannot find command (command.com)
I even tried this

  if ShellExecute(Handle, nil, PChar('C:\WINDOWS\system32\command.com /k dir'), nil, nil, SW_SHOWNORMAL) <= 32 then
    ShowMessage(SysErrorMessage(GetLastError));

and it showed message "The system cannot find the file specified"

How come?? Did I miss something????
0
 
LVL 6

Author Comment

by:Hardi
ID: 8208047
Oh! the '-k filename' should go into parameter!!
thx thx that worked great ^_^
0
 

Expert Comment

by:defy_boy
ID: 8208120
:p
0

Featured Post

Independent Software Vendors: 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

577 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