Sign in to follow this  

console handles [c++]

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to edit the data in a console screen buffer, but I don't know how it is set up. Currently I have a handle to the buffer, then a COORD variable to get the location I want. This is basically what I have:
void text_color(COORD location, WORD color, WORD mask)
{
	HANDLE console_tag = GetStdHandle(STD_OUTPUT_HANDLE);
	console_tag.location.Attributes &= mask;
	console_tag.location.Atrributes |= color;
}
I get errors on console_tag and location, "they aren't a class/struct/union type". 'Attributes' is data in 'CHAR_INFO' which is part of the screen buffer. Can anyone help me with this please? P.S. How do I add a code box? [Edited by - Scavenger23 on August 29, 2005 5:21:10 PM]

Share this post


Link to post
Share on other sites
I want to write a function from scratch. All of the functions I have tried don't do what I want to do. I need to access the buffer's structure so I can do what I need from there. Is the handle like a pointer?

Share this post


Link to post
Share on other sites
A handle is defined as a void* pointer so that's all that it is really. Could be anything, in short you just pass it around but you can't really use it for anything outside the scope of the functions that use it. Like the person above said its a very opaque type... o_O

Share this post


Link to post
Share on other sites
Quote:
Original post by Scavenger23
I want to write a function from scratch. All of the functions I have tried don't do what I want to do. I need to access the buffer's structure so I can do what I need from there. Is the handle like a pointer?

HANDLEs are completely meaningless to you, as the programmer. They only have meaning to the Win32 API which means that all you can do with them is pass them around functions in the Win32 API.

If you want to write a function to draw something in the console you'll need to use a combination of Win32 console functions.

Share this post


Link to post
Share on other sites

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this