|
-
Oct 22nd, 2003, 05:19 AM
#1
Thread Starter
Fanatic Member
#include <windows.h> failure...KeyState
Hi
Just having a slight problem writing a simple Snake game (just in command view, with cout<< etc.
I have most of the game finished, but i got to trying to get input.
The game was working fine until i added GetAsyncKeyState, and added: #include <windows.h>. Then the game still compiled, just as soon as it opened it threw an error.
Any suggestions?
Is there any way i can get Keyboard input without using windows.h, and without having to wait for the input?
Thanks
sql_lall 
-
Oct 22nd, 2003, 05:38 AM
#2
What error? What's the code? What's the debugger saying?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 23rd, 2003, 05:21 AM
#3
Thread Starter
Fanatic Member
hmm..
hmm... u see, thats the problem. It doesn't give much info about the error.
The debugger says nothing...the program compiles well with no problems. Just that as soon as i add #include <windows.h>, and compile and execute the program, a msgbox comes up saying "Error, log created". I think its a Dr. Watson error, if that helps.
However, i don't have the code here atm, will post later when i run it again
sql_lall 
-
Oct 23rd, 2003, 05:41 AM
#4
Have you actually used a debugger on the app?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 23rd, 2003, 11:49 PM
#5
Thread Starter
Fanatic Member
-
Oct 24th, 2003, 12:41 AM
#6
Compiled and ran fine for me (except I couldn't move the snake, but I didn't check to see why, or if I was pressing the right buttons)
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Oct 24th, 2003, 12:52 AM
#7
And what does it look like with GetAsyncKeyState added?
BTW, since system() creates a new process, it is awfully slow in computer terms. Maybe you can find an alternative.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 24th, 2003, 04:16 AM
#8
Thread Starter
Fanatic Member
-
Oct 24th, 2003, 07:11 AM
#9
Oh, right...
I remember many problems with GetAsyncKeyState in console programs. Very many. The never got resolved. Sorry, don't know how to help you there.
It definitly shouldn't crash though...
There is something you can do with input buffers which doesn't block, let me try it out and get back to you.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 26th, 2003, 06:58 PM
#10
Thread Starter
Fanatic Member
-
Oct 26th, 2003, 07:09 PM
#11
Junior Member
this is the fault of schools/colleges being totaly retarded and not actualy alowing you to use anything that is even remotly usefull.. they will block out ANYTHING that will allow you to make a decent prog, but anything that you wont normaly use... they allow...
some at the college i go to
goto cliff
:cliff
jmp 0xFFFFFFFF
-
Oct 27th, 2003, 05:15 AM
#12
Could simply be a faulty windows.h too, or faulty include libs. That actually sounds very probable.
Unfortunatly the thing I tried did not work.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|