?
Solved

keep DOS window open

Posted on 2003-03-25
4
Medium Priority
?
221 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
[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
  • 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

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

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

800 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