Well, I have two handles. One for the keyboard and another for the screen(Im working on a new game) and I have a function that initializes them defined in a .cpp file. But whenever I try to InitHandles (); It acts as though they dont even exist?
Well, I have two handles. One for the keyboard and another for the screen(Im working on a new game) and I have a function that initializes them defined in a .cpp file. But whenever I try to InitHandles (); It acts as though they dont even exist?
"Borland Rocks!"
InitHandles() - where are you getting that from?
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
which compiler are you using?
and cna you post some code?
Try to help all less knowledgeable than yourself, within
the limits provided by time, complexity and tolerance.
- Nor
Im using VC++ 6.0. Here is what InitHandles() looks like
int InitHandles(void)
{
HANDLE q_Screen;
HANDLE q_Keyboard;
q_Screen=GetStdHandle(STD_OUTPUT_HANDLE);
q_Keyboard=GetStdHandle(STD_INPUT_HANDLE);
return (0);
}
"Borland Rocks!"
sorry for not using tags, il use them from now on
"Borland Rocks!"
How about actually telling us what happens? Do you get an error at compile time? Do you get an error at run time? What exactly? Just saying "it acts like..." doesn't tell us anything.But whenever I try to InitHandles (); It acts as though they dont even exist?
That being said, if that is all your function does, how on earth do you expect it to actually do something?
Let's look at this function:
I can only assume that "acts like they don't exist" means that in fact you end up with no handles. Well, that makes sense, since your local variables are toast after this function ends.Code:int InitHandles(void) { HANDLE q_Screen; /* local variable */ HANDLE q_Keyboard; /* local variable */ q_Screen=GetStdHandle(STD_OUTPUT_HANDLE); q_Keyboard=GetStdHandle(STD_INPUT_HANDLE); return (0); /* local variables destroyed */ }
Furthermore, you never actually check or do anything with either of these variables, other than temporarily assign them a value.
Quzah.
Hope is the first step on the road to disappointment.
At compile time I get three errors and here they are:
error C2556: 'int __cdecl InitHandles(void)' : overloaded function differs only by return type from 'void __cdecl InitHandles(void)'
error C2371: 'InitHandles' : redefinition; different basic types
error C2065: 'q_Screen' : undeclared identifier
"Borland Rocks!"