Results 1 to 5 of 5

Thread: CapsLock

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    How can I turn the capslock on in C++? I am just making a console program for my computer class, but the program I am making requires you to turn the capslock on for it to work. Thanks.
    <removed by admin>

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    BYTE bar[256];
    GetKeyboardState(bar);
    bar[VK_CAPITAL] = 1;
    SetKeyboardState(bar);
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    I tried that code, and I get 9 errors. How can I fix this?

    Thanks again.
    <removed by admin>

  4. #4
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    The code works fine for me. Did you include windows.h
    Code:
    #include <windows.h>
    ....
    BYTE bar[256];
    GetKeyboardState(bar);
    bar[VK_CAPITAL] = 1;
    SetKeyboardState(bar);
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  5. #5

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks! I didn't know I had to include windows.h. I'm realitively new to C++ programming, so I don't know all the different headers that are needed. Thank you Vlatko.
    <removed by admin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width