Sign in to follow this  
  • entries
    10
  • comments
    13
  • views
    4851

First entry

Sign in to follow this  
rmckee78

184 views

Well, this is my first journal entry. I have been fooling around with programming for a while, and I took a few C and C++ classes in college. I use MATLAB at work so I have some programming background (not much).

I currently work as a mechanical engineer designing homeland security barriers (big cables and chunks of concrete to stop vehicle bombs). I am also preparing to take the Patent Bar Exam to expand my career options (and my wallet). I have always made games for my own enjoyment (and my friends), so far these have been of the board, card, and PnP RPG variety. I have always been interested in video games.

This marks the start of my serious attempt at learning how to program. Everything I have done up till this point has been in a console box (or high level interpreted stuff like MATLAB). One of my first larger goals is to learn how to interact with Windows. This will give me some immediate gratification (useful to keep me going) and some understanding of how Windows works (chances are there is not much career future in DOS games).

Since I have a basic knowledge of C and C++ I will be using these languages to learn with. I will be using the Dev-C++ compiler because I am somewhat (but not very) comforatable with it. I downloaded Visual Studio Express the other day
but could not get some things I already knew how to do working on it. Also I could not seem to make it find . This is a hassle I don't need while I am starting.

I have purchased a whole bunch of game programming books over the years. I would start on one, then school would get in the way, and I would be put it aside. I have a good enough library from this (and picking things up when they didn't sell at the major retailers and hit the $10 rack) to start with. I spent last night looking through them for one that seems to have a good overview of starting out in Windows programming (getting a window to open would be nice). I selected OPENGL Game Programming by Hawkins and Astle, I liked the look of its Windows section the best. I will base (but not limit) the first part of my study on this book. I also have at my disposal a print out of the NeHe tutorials, and a book OpenGL Programming Guide 5th ed. that is available at work.

After reading through the first few sections my first attempt will be to make the Hello World pop-up box.


//Hello World in Windows
#define WIN32_LEAN_AND_MEAN //trim down the libraries
#include //main windows headers

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
//message box with Hello World
MessageBox(NULL,"Hello World", "First",NULL);
return 0;
}





As I read through the function description for WinMain I notice that lpCmdLine is a string that holds any command line parameters. Time for an experiment:


//Hello World in Windows
#define WIN32_LEAN_AND_MEAN //trim down the libraries
#include //main windows headers

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
//message box with command line string
MessageBox(NULL,lpCmdLine, "First",NULL);
return 0;
}





Good, by running my executable from the command line I can dicatate the message box contents via command line parameters. It is always nice when stuff works like you expect it to.
Sign in to follow this  


5 Comments


Recommended Comments

Welcome to the journals!

VC++EE doesn't come with everything you need for native Win32 apps, only for C++/CLI apps. You will need to download and install the Windows Platform SDK (as mentioned on the VC++EE download page). There are a number of sites, such as this one, with guides on configuring the PSDK and VC++EE to work together.

Dev-C++ is only an IDE, I believe the compiler is MinGW. I always found VS much more fun to work with. [smile]

Share this comment


Link to comment
Quote:
Original post by benryves
Welcome to the journals!

VC++EE doesn't come with everything you need for native Win32 apps, only for C++/CLI apps. You will need to download and install the Windows Platform SDK (as mentioned on the VC++EE download page). There are a number of sites, such as this one, with guides on configuring the PSDK and VC++EE to work together.

Dev-C++ is only an IDE, I believe the compiler is MinGW. I always found VS much more fun to work with. [smile]


Ah, I downloaded the SDK but didn't realise I had to set it up. I'll have to take a look at this later.

I was unaware that Dev-C++ was not itself the compiler. I suppose this means that I need to look up the compiler name itself if I am having problems?

Share this comment


Link to comment
Quote:
Original post by rmckee78
I was unaware that Dev-C++ was not itself the compiler. I suppose this means that I need to look up the compiler name itself if I am having problems?
After looking it up, it does appear to be MinGW. Code::Blocks is another freeware IDE geared towards C/C++ development, which can also use MinGW (I think it's a little more up-to-date than Dev-Cpp).

At the end of the day, just use what's the most comfortable to you. I just thought I'd mention the PSDK, as it seems to be a common complaint about VC++EE.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now