Hello:
I'm making a program that will control a little camera as a security device. That is, the camera is connected to the computer using the serial cable, and it will receive things that way.
I want that the user can press the UP key and the camera will move a little up. I've covered the movement and data transmission stuff, so I'm bassically stucked in the C++ programming and registering keyboard events thing.
I tried:
Code:
#include <iostream.h>
#include <stdlib.h>
int main()
{
char key;
cout << "Press a key " << endl;
cin >> key;
cout << "You pressed: " << key << endl;
system("PAUSE");
return 0;
}
but it doesn't do the trick, for the following reasons:
** It waits for the user to press enter, and I don't want that. Just the key to be pressed
** It only gets the keys with a "char" value, meaning, it does get the 'a' key but not the 'UP' key.
** Pressing UP key wil bring the last command pressed (as the shell usually do).
So I've googled for it and I found out that this type of keyboard management is not recognized by an ANSI standard because (curious) it's not standard.... I learned that the way the OS does this is different, lets say, from UNIX to Windows.
I've done some Windows specific programming before, like using Windows.h, handlers and all that, so that when I wanted to register keyboard I just had to do a switch and case with all the possible keys.... but I don't (can't) use MFC or win specific thing this time.... even tough I do need it for windows....
Is there a way to do this? even if it means to include ASM code inside the C++ programm?
Thanks a lot.