Thread: How do you toggle keys like Scroll lock without Windows API?

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    14

    How do you toggle keys like Scroll lock without Windows API?

    I've seen that there are ways to toggle keys like Scroll Lock, Caps Lock and Num Lock using the windows API, but is there a way to do so without it?

    The reason for not wanting to use the Windows API is because if I were on Linux, Unix or DOS, I wouldn't be able to utilize the windows API since it isn't installed.

  2. #2
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    well which do you want? dos? linux? macOS?
    hello, internet!

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Something like that is going to be hardware/OS specific, so you won't be able to write anything using purely standard C++ functions.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    14

    More specific:

    Since there isn't a standard for all computers using C++, how would you toggle keys using DOS?

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: More specific:

    Originally posted by animeaholic
    Since there isn't a standard for all computers using C++, how would you toggle keys using DOS?
    DOS or Windows Console? I don't have the answer, just thought you should clarify your question.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    14

    Clarification

    What I mean by DOS is that It is a dos based program, it doesn't use the windows API and it isn't in a Windows Console window.

    The code should be able to run in both a dos prompt or in MS-DOS mode.

  7. #7
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Whichever os you need this for will require different things. For instance a console window will need to use win32 api. In DOS it can be accomplished by calling an interrupt with the registers set correctly. Ralf browns interrupt list should help there. On linux I dont know. You will have to research that too. Then when you have all the different methods you can use the preprocessor and conditional compilation to maintain a single-source.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  8. #8
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by Stoned_Coder
    Whichever os you need this for will require different things. For instance a console window will need to use win32 api. In DOS it can be accomplished by calling an interrupt with the registers set correctly. Ralf browns interrupt list should help there. On linux I dont know. You will have to research that too. Then when you have all the different methods you can use the preprocessor and conditional compilation to maintain a single-source.
    a dos proggie running in a 95/98 dos box can successfully use the dos techniques for setting the lights.
    hello, internet!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Want to learn Windows API for Game Programming
    By George M. in forum Windows Programming
    Replies: 15
    Last Post: 09-28-2008, 10:26 AM
  2. Windows API
    By valaris in forum Windows Programming
    Replies: 7
    Last Post: 08-01-2008, 12:37 AM
  3. windows api file functions
    By xixpsychoxix in forum Windows Programming
    Replies: 8
    Last Post: 07-01-2008, 04:26 PM
  4. windows api functions, not working. requirements?
    By Mr.Bit in forum Windows Programming
    Replies: 5
    Last Post: 10-10-2007, 08:20 AM
  5. MFC or Windows API
    By aresashura in forum Windows Programming
    Replies: 7
    Last Post: 12-01-2001, 10:21 PM