keep DOS window open

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 :)
LVL 6
HardiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

defy_boyCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HardiAuthor Commented:
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
HardiAuthor Commented:
Oh! the '-k filename' should go into parameter!!
thx thx that worked great ^_^
0
defy_boyCommented:
:p
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.