Advertisement

Windows App Questions

Started by November 25, 2002 01:27 PM
2 comments, last by Betrayer_of_Code 21 years, 11 months ago
I have a little knowldege of classes, I can generally make my own, though they usually take a lot of degbugging. I was wondering if making Windows Applications was my next step. Are they important? Do I need them? or is there more basic stuff I should learn first. Is the coding for Widows App''s a lot different. If so will the code I have learned so far in C++ be obsolete? Plz Help I dont want to skip ahead and not understand!
BoC HomepageLuck is a Horse to ride like any other...Luckily im not a gambler, I dont know how to ride.
Well that is a rather broad question in case you didn''t know. To code a "windows app" you can make it a Win32 app, MFC, OWL, etc. More than likely you were talking about a standard Win32 app that uses a winmain rather than main, etc. They are very different in structure to a basic console app (also assuming that is what you are currently writing). However, the fundamentals that you are learning from C++ will transfer over. If you are still having issues with classes, I would recommend staying where you are for a bit. Get a handle on those as you will probably be doing a lot of them. but that''s just my opinion...

Always remember, you''''re unique. Just like everyone else.
Always remember, you''re unique. Just like everyone else.Greven
Advertisement
Here''s a brief comparaison of Win32 apps and console mode apps...

Console mode...
...is pretty simple. Your program goes from start to finish. You execute stuff in your main(), and that''s all there is to it.

Win32...
...is a bit more complex. First of all, Windows programs aren''t called with command-line parameters like in DOS. You can also have multiple windows and programs active at the same time. For these reasons, you don''t use main() but WinMain(), which uses various parameters that allow you to keep track of stuff like the handle to an instance of your program.
Also, since you''re working in a multi-tasking environment where programs can communicate with each other, you''ll have to occasionally check to see if other things like the OS are sending message to your window(s). For instance, "Hey, the user clicked on your little ''x'', can you close?" or "Ok, the user did something to hide you and now your window is visible again." or event "Oh, the user pressed ''space''." Well, it''s not exactly like that but you get the idea.
For the above reason, you can''t simply have a program go from start to finish. You have to go check on the little pile of messages your window(s) is/are receiving and do something about them. So you can''t have a "pause" that would completely halt the program, say, a second where you''d just do nothing until a second has passed.
And finally, you gain the use of the good ''ol API and other assorted Windows-specific features.

Well, essentially, that''s it. No need to worry, a for() loop is still a for() loop even in Windows. As for needing them, that''s up to you. DOS is pretty much dying out just like 2D is being replaced by 3D (*sniffle*). It''s your decision. You should code on whichever platform you enjoy coding on if you''re not doing anything serious (like a commercial game, for instance).
In a Win32 app after making the window is the rest of the coding the same.
i.e.
If i typed
cout<<"Hi";
would it still print Hi? or do I have to add stuff to scenter it and crap?

My funnies:
"My mom was a ventriloquist and she always was throwing her voice. For ten years I thought the dog was telling me to kill my father."
and:
"The longest word in the english language is the one that follows the phrase, ''''And now a word from our sponsor''''."
BoC HomepageLuck is a Horse to ride like any other...Luckily im not a gambler, I dont know how to ride.

This topic is closed to new replies.

Advertisement