Problem

I'm still trying out random codes from my Windows Game Programming for Dummies book. I created a program that creates a window on my Dev C++ compiler and I added the code for a simple spaceship game. It has some errors

Sweetie, I don't believe you can have both main() AND WinMain()....you see, WinMain() is the entry point for a Win32 program, and main() is the starting point for a console app....I'm pretty sure you cannot have them both. If that's correct, and you want to have a Win32 app, you should take all your code from main() and stick it into WinMain().

Besides, you were trying to define a function inside of another one. That ain't right. Can't do that hun.

Anyhoo dear....this might be a shot in the dark...but try using PostQuitMessage(0); in the if(key=='q') part and such to fix the exiting problem. That won't help your compile errors much though.

I'm not much for Win32...but it seems like something about your return statement seems to be screwy. Anyhoo...it seems like maybe you should hone your skills a tad before diving into the Win32 world, hun. I mean...you had two entry-point functions....and one was even defined inside the other....that's bad news sir. Maybe you should get yourself some more learnin' in, eh?

Nah, that doesn't work. I cleared the code of all the console stuff, so it just opens a window. So now lets get back to my original question. When I run my program to create a window, the window appears, but I can't close it. You can't even click on the buttons in the top right corner and alt f4 doesn't work, right clicking and selecting close on th e tab at the bottom of the screen doesn't work. The only way is to use ctrl alt delete, which gets annoying after a while. How can I fix that? Here is the code:

You still have a console app running in the background along with the created window. Closing that will kill the window. If I had more time, maybe I could help you out with getting rid of the console app in the background, but I'm sure one of our Win32 whiz-kids will jump in and come to your rescue.

Bleh, I'm confused with all this stuff.
I plan to move on to something WAY less difficult. Something which I can mess around with and to use to learn the basics. So, thanks for all your help everybody.

Bleh, I'm confused with all this stuff.
I plan to move on to something WAY less difficult. Something which I can mess around with and to use to learn the basics. So, thanks for all your help everybody.