[C++] File Executing

Posted By: mpdeveloper_B

[C++] File Executing - 04/04/09 03:26

Ok, I am writing a Cpp launcher application, and well, as I've probably mentioned before...I'm a complete noob. As a matter of fact to be precise, I'm trying to make a splash screen for a 3DGS game I'm working on, hopefully that info is helpful. I'm using A6.60 Com. Any help would be appreciated, and I'd gladly add you to the credits.

Before Reading below keep this in mind: I can't use any MFC stuff, I'm using a free compiler.

I have two problems I would like to address:

First off:
I am executing a file and trying to monitor it's output with this line:

Code:
FILE *fp = popen("Kino.exe", "r");


but there are 2 problems.

First, the application is launched, but I see a split second popup of the command prompt...and well...frankly, I don't want that. How can I prevent this popup?

Second is that I'm not sure how to monitor if the application is closing, or changing. It is critical that I can do that. I've heard that it's easy, but well...I'm a noob.

Second Problem:

This problem has been fixed, I found a way using RAD c++ to keep the window on top perfectly.

I can post code if you want, or the full source, but I'm using Dev C++ with the RAD C++ plugin, so most of the code is written by the RAD plugin.

Edit: Second problem was fixed..
Posted By: TechMuc

Re: [C++] File Executing - 04/04/09 10:35

comment in msdn:
Quote:
Note If used in a Windows program, the _popen function returns an invalid file pointer that will cause the program to hang indefinitely. _popen works properly in a Console application. To create a Windows application that redirects input and output, see Creating a Child Process with Redirected Input and Output in the Platform SDK.



to open a file use ShellExecute (http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx). You have to include shellapi.h and bind shell32.lib
Posted By: mpdeveloper_B

Re: [C++] File Executing - 04/04/09 14:15

Thank you TechMuc. With some changes I have made I don't have to return the processes' status. I am now using:

int fp = WinExec("Kino.exe", SW_HIDE);

and the window auto closes after a few seconds. It looks really good, but I now have to work on a way to auto resize it and the image in different resolutions.
Posted By: Michael_Schwarz

Re: [C++] File Executing - 04/04/09 14:17

About your MFC problem... why can't you use the MS Visual C++ Express edition? It's free and has no limitations to the compiler AFAIK.
Posted By: mpdeveloper_B

Re: [C++] File Executing - 04/04/09 18:56

except that you can't use a project for commercial use.
Posted By: mpdeveloper_B

Re: [C++] File Executing - 04/06/09 16:33

Ok, most everything is working and it looks good, I just need to know how to do one thing. How can I check if a key has been pressed?
© 2024 lite-C Forums