I'm trying to avoid using a huge class that has capabilities of reading
every key, so the final file size is reduced...if possible.
is there any way, at all??
cause I haven't found anything...I was just hoping to keep it small...
I can easily get the alpha-numerics...just need to get the scrolling.
btw...I'm using a laptop with only a 60GB HDD and a 1.6GHz mobile
processor.
I'm in college and this is meant to be an "Extra Credit" project.
Many businesses still use computers that run DOS or older OSs.
And trying to simply say "You need to update" isn't going to work.
Cause the cost of updating would be too great when they already have a
system that works.
So...with that in mind...why wouldn't you want to go small??
Unless the program was completely for personal use...when you know you
have the resources...why wouldn't you try to make it as small as
possible??
Do this in your window handle fucntion:
bool keys[256]; // Array Used For The Keyboard Routine
LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
UINT uMsg, // Message For This Window
WPARAM wParam, // Additional Message Information
LPARAM lParam) // Additional Message Information
{
switch (uMsg) // Check For Windows Messages
{
case WM_KEYDOWN: // Is A Key Being Held Down?
{
keys[wParam] = TRUE; // If So, Mark It As TRUE
return 0; // Jump Back
}
case WM_KEYUP: // Has A Key Been Released?
{
keys[wParam] = FALSE; // If So, Mark It As FALSE
return 0; // Jump Back
}
}
// Pass All Unhandled Messages To DefWindowProc
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
:)) Jacob, Here WM_KEYUP and WM_KEYDOWN doesn’t mean up arrow key nd down arrow key. It means a key is pressed nd released. It also commented there. Didn’t u notice that.
use
if (keys[VK_UP]) cout << upkeypressed
case WM_KEYUP:
// Has A Key Been Released?
{
if( wParam == VK_UP)
// do the code for the up arrow being
released
else if( wParam == VK_DOWN)
// do the code for the down arrow being
released
else if( wParam == VK_LEFT)
// do the code for the left arrow being
released
else if( wParam == VK_RIGHT)
// do the code for the right arrow being
released
break;
}
This will check to see if one of the arrow keys have been released up.
If you want the user to be able to just hold down the keys and the
effects are repeated then use case WM_KEYDOWN instead of WM_KEYUP.