quick black screen

Started by
14 comments, last by password 17 years, 12 months ago
Quote:Original post by Lanky007
I am using VC++ 6.0 Professional edition, I can compile and run my program just fine, except when after I compile it in release mode and go to the folder the workspace is in, and double-click the executable it comes up and then just disappears. I think this might have to do with VC's non-distributable thing or something but I don't know. If I run the code from within the workspace environment, it works fine, but the double-clicking the executable will do the quick screen thing. Anyone know why this happens?


Getting back on topic. The problem is windows closes the command shell automatically when a dos program terminates. One solution to this problem is to open a command shell first (run cmd.exe) and then your executable. You can also make a registry tweak, to add the ability to run the command shell at any folder. This will let you open a shell right in your release folder.

I think there use to be an option in DOS shortcuts that would allow you to force the window to stay open after execution, but I no longer see it in XP.

Hope that helps.
Imagination was given to man to compensate him for what he is not.A sense of humor was provided to console him for what he is.-Horace Walpole
Advertisement
That cin.get() works if it is a Console Application, but mine was a Win32 Application so it didn't work with that. I also tried opening up a cmd shell and then running it, still nothing. But I realize my slowness even more now, I figured out what the problem was. I am making a simple little Pong game using SDL and so the program requires access to a bunch of images (background, paddles, ball, etc). So when VC++ makes a release version, it makes a folder in the working directory called "Release", and that is where the executable is, but the program as it was written expects all the image files to be in the same directory as the program so I just moved the executable from the "Release" up (back to the working directory) one directory to where all the images and fonts and such that it expects were and it worked. Ok, so now I have a new question, is there any way to make an executable where these images don't need to be accessed? Like if I wanted to run this program on a different machine I would have to supply all the images as well, but is there any way around that so just the executable is needed to run the program?

As for the linux business. I know next to nothing about it. For the purposes I use the computer, Windows works fine, and I have had no reason to look for different OS's or semi-OS's, etc. I used linux a few times, and for my purposes for using computers, I prefer Windows. I like buttons, mouse-clicking and...windows and all that stuff. I found something...

http://www.microsoft.com/windowsserversystem/facts/default.mspx
I use to have a while loop like this:
while (!!cin) cin.get();

Or if you prefer it without using the using directive:
while (!!std::cin) std::cin.get();
why (!!cin) instead of (cin) or for that matter, instead of (!!!!cin) or (!!!!!!cin) or.... well u get the idea. lol just curious...
Quote:Original post by Lanky007
That cin.get() works if it is a Console Application, but mine was a Win32 Application so it didn't work with that. I also tried opening up a cmd shell and then running it, still nothing. But I realize my slowness even more now, I figured out what the problem was. I am making a simple little Pong game using SDL and so the program requires access to a bunch of images (background, paddles, ball, etc). So when VC++ makes a release version, it makes a folder in the working directory called "Release", and that is where the executable is, but the program as it was written expects all the image files to be in the same directory as the program so I just moved the executable from the "Release" up (back to the working directory) one directory to where all the images and fonts and such that it expects were and it worked. Ok, so now I have a new question, is there any way to make an executable where these images don't need to be accessed? Like if I wanted to run this program on a different machine I would have to supply all the images as well, but is there any way around that so just the executable is needed to run the program?

As for the linux business. I know next to nothing about it. For the purposes I use the computer, Windows works fine, and I have had no reason to look for different OS's or semi-OS's, etc. I used linux a few times, and for my purposes for using computers, I prefer Windows. I like buttons, mouse-clicking and...windows and all that stuff. I found something...

http://www.microsoft.com/windowsserversystem/facts/default.mspx



If your doing a Win32 app research how to include resource files. This way your additional content is included either directly in the executable or provides a way to provide path names for your files so you can segregate say music and video files into two separate folders. Using the second method you would need an installer program to ensure your files are placed into the appropriate folders.
Imagination was given to man to compensate him for what he is not.A sense of humor was provided to console him for what he is.-Horace Walpole
Quote:Original post by Lanky007
why (!!cin) instead of (cin) or for that matter, instead of (!!!!cin) or (!!!!!!cin) or.... well u get the idea. lol just curious...


That's true, I really don't see the point either. I tried it and every time two !! are used, they kind of take out eachother and evaulate true anyways. Well it's not originally my idea, I got that from a c++ site and I has used it in every c++ program since then. Logically it should be like this in my option:
while (!cin) cin.get(); because that should mean that it activates the cin.get function while there are no other cin functions active, looks like there is a big illogical hole.

Just use while (true) or while (1) instead they are much kinder :))
or just use cin.get plain and simple like it is, that should do it.

This topic is closed to new replies.

Advertisement