TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTOPHER BUTLER
from: KURT KUZBA
date: 1997-04-20 05:27:00
subject: Scroll Lock

CB>   Thanks to the person (or people, if the messages haven't
CB>   reached me yet ), who replied to my message on getting
CB>   the scroll lock status.
CB>   Just one question, how would I change the status?
cb>....
   Just change the BIOS shift status register byte, in DOS.
#include 
#include 
class ShiftKeysStatusClass {
public:
   int Rightshift()    {   return status(1);   }
   int Leftshift()     {   return status(2);   }
   int Control()       {   return status(4);   }
   int Alt()           {   return status(8);   }
   int Scroll_lock(int set = 0)
   {   return set ? status(16) : toggle(16);   }
   int Num_lock(int set = 0)
   {   return set ? status(32) : toggle(32);   }
   int Caps_lock(int set = 0)
   {   return set ? status(64) : toggle(64);   }
   int Insert(int set = 0)
   {   return set ? status(128) : toggle(128); }
private:
   int toggle(int key)
   {   return *((char*)0x00400017L) ^= key;   }
   int status(int key)
   {   return !!(*((char*)0x00400017L) & key);   }
};
int main(int c, char **v)
{
   ShiftKeysStatusClass KeyStats;
   if(c > 1)
   {
      if(strstr(v[1], "off") || strstr(v[1], "OFF"))
      {
         if(KeyStats.Scroll_lock())
            KeyStats.Scroll_lock(1);
         if(KeyStats.Caps_lock())
            KeyStats.Caps_lock(1);
         if(KeyStats.Num_lock())
            KeyStats.Num_lock(1);
      }
      else
      {
         if(!KeyStats.Scroll_lock())
            KeyStats.Scroll_lock(1);
         if(!KeyStats.Caps_lock())
            KeyStats.Caps_lock(1);
         if(!KeyStats.Num_lock())
            KeyStats.Num_lock(1);
      }
   }
   else
     cout << "Any argument toggles locks on.\n"
           " \"off\" toggles lock keys off.";
   return 0;
}
> ] I'm not materialistic. I'm just Object Oriented.............
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.