--> Christopher Butler wrote to All <--
CB>Does anyone have some C++ code that checks the condition of Scroll
CB>Lock?
Chris, for DOS, try:
class KeyState {
private:
const char far *ks; // Pointer to BIOS keyboard flag
public:
// Use a constructor to initialize the pointer
KeyState() { ks = (char far *) 0x00400017L; }
// If your compiler doesn't support bool's use int
bool CapsState(void) const { return (bool) (*ks & 0x40); }
bool NumState(void) const { return (bool) (*ks & 0x20); }
bool ScrollState(void) const { return (bool) (*ks & 0x10); }
};
// Test with this...
#include
int main(void)
{
KeyState k;
if(k.CapsState())
cout << "Caps State is on";
else
cout << "Caps State is off";
cout << endl;
if(k.NumState())
cout << "Num State is on";
else
cout << "Num State is off";
cout << endl;
if(k.ScrollState())
cout << "Scroll State is on";
else
cout << "Scroll State is off";
cout << endl;
return 0;
}
X CMPQwk 1.42 1692 X"Everything is sweetened by risk." - Alexander Smith
--- Maximus/2 3.01
---------------
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
|