Visual C++ problem. Easy!

Visual C++ problem!!!

I have a problem with a Borland C++ Dos converter i've made. Here's the part you need of the code:

void CBorlandCConverterDlg::OnStart()
{
     
     WinExec("bcc32 " + m_Target, SW_SHOW);
     
}
          After this DOS command I want a pause, so the command window will be there until the person pushes a button.

So the program works fine, but When this command is finished the command window closes itself.

Thanks!
TMMAsked:
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.

Fallen_KnightCommented:
well if you want a delay untill user action:

use iostream and just go

char ch;

cout << "Press any key to continue"
cin >> ch;

or even just a cin.get(); might work just fine.

so
void CBorlandCConverterDlg::OnStart() {
    WinExec("bcc32 " + m_Target, SW_SHOW);
    cin.get();
}
0
TMMAuthor Commented:
This is a Windows program, not a DOS...
0
EarthQuakerCommented:
system("pause");
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

nietodCommented:
rather than running the bcc32 program directly, run a command interpreter (command.com or cmd32.exe depending on the OS) and have the command interpreter run bcc32.
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
nietodCommented:
For example

  WinExec("command.com /Kbcc32 " + m_Target, SW_SHOW);

this runs command.com with the /K command-line option, which runs a command and then after the command finishes, command.com continues to operate--wait for user input.

>> system("pause");
that douesn't work.  TMM needs to pause in an exusting  DOS box after it has completed a task.
0
nietodCommented:
I should mention that you can get the path to and name of the command interpretter using the COMSPEC environmental variable
0
TMMAuthor Commented:
Thanks nietod, but it dosen't work.
Do you have another method???
0
nietodCommented:
I what way doesn't it work?  (doesn't run, doesn't run right, doesn't pause ....)    Don't abandon the approach at the first setback.  It will work.
0
TMMAuthor Commented:
The command window says "invaild reference!"
Do you know whats wrong then?
Thanks
0
nietodCommented:
post your code.   I need to see what you are doing
0
bcladdCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to nietod

Please leave any comments here within the next seven days. Experts: Silence
means you don't care.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer

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
C++

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.