Console functions

Started by
13 comments, last by Android_s 20 years, 11 months ago
Ahh, great! It works much better now Thank you very much!
Though...i do have one further question now of this new code. That "if(WAIT_TIMEOUT...bla bla", what exactly does it do? Why did it work with the ReadConsoleInput() now? Me feeling stupid... =/

[edited by - Android_s on April 21, 2003 6:00:18 PM]
----------------------------------------------------------------------------------------------------------------------"Ask not what humanity can do for you, ask what you can do for humanity." - By: Richard D. Colbert Jr.
Advertisement
Good question I know how to use it, just not how it works

My guess its some sort of multithreading, but I'm really clueless how it does it.

Jeff D

EDIT: That line tells the program to wait some number of milliseconds for imput if none is given then return.

Also why it works now I believe it was a void function before trying to return is what caused it to not work, making it a function that returned what it did then mowent to your move function worked. I'm somewhat still a newbie in programming as you.

[edited by - Jeff D on April 21, 2003 7:42:50 PM]
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Ahh, ok..hmm...i have to look into that, hmm...
Thanks anyway for the help

[edited by - Android_s on April 22, 2003 7:12:55 AM]
----------------------------------------------------------------------------------------------------------------------"Ask not what humanity can do for you, ask what you can do for humanity." - By: Richard D. Colbert Jr.
-
if(WAIT_TIMEOUT == WaitForSingleObject(m_hInput, 20)) return;
-

With a call to WaitForSingleObject you instruct the operating system to wait for the given kernel object to become signaled. While waiting for the object the os can shedule another thread for processing time. When the object is signaled the function returns and the calling thread can be sheduled again. In this case the kernel object is a input handle, the object becomes signaled when there is any input pending.

Ahh, thanks Rob! Starting to become a bit clearer now I think i have figured out exactly (or damn close) what it does. After looking at Jeff D''s code again and toasting my mind a couple of minutes things is getting clearer. Thanks once again
----------------------------------------------------------------------------------------------------------------------"Ask not what humanity can do for you, ask what you can do for humanity." - By: Richard D. Colbert Jr.

This topic is closed to new replies.

Advertisement