Teen Programmers Unite  


Return to forum top

HANDLES and windows.h in C

Posted by Mycroft [send private reply] at March 05, 2002, 06:33:02 PM

Well, I can say I'm a beginner programmer, I know ANSI C and a few other basic languages. I'm working on a simple DOS based text maze game. I have about 600 lines of C code in it so far. Currently I'm working on the maze basics and am basing it off of some premade code which I am altering and adding to. The problem is I don't have a good grasp of HANDLEs, I know what they are but I'd like to know how they work so I can make my own. All so I was wondering if anyone has a good article on the main functions of the windows.h header in C.


Posted by taubz [send private reply] at March 05, 2002, 08:13:47 PM

Handles are just numbers that Windows uses to keep track of things. Each window has a number. Each bitmap has a number. Some functions in windows.h (like CreateWindow) will return the number/id/handle of the window that was created. Then you pass that number/id/handle as an argument to other functions (like ShowWindow) that operate on the thing that the number corresponds to.

You shouldn't need that for a DOS-based game, though.

- taubz

Posted by Mycroft [send private reply] at March 05, 2002, 08:31:11 PM

I'm using a handle for WriteConsoleOutput().

Posted by taubz [send private reply] at March 06, 2002, 09:36:31 AM

Handles are still just numbers which refer to something else. I looked up that function on msdn.microsoft.com/library, and in the case of that function it's a number which just refers to a "screen buffer."

If you do poking around on that website, you'll find the functions for creating new screen buffers and activating them.

- taubz

Posted by metamorphic [send private reply] at March 06, 2002, 02:47:30 PM

www.gametutorials.com have a great tutorial on making a DOS console text-based maze game

Posted by Mycroft [send private reply] at March 06, 2002, 05:04:57 PM

Thanks, both the MSDN and gametutorial sites helped.

You must be logged in to post messages and see which you have already read.

Log on
Save for later automatic logon

Register as a new user
Copyright TPU 2002. See the Credits and About TPU for more information.