An old question about system key

Posted on 2006-05-04
Last Modified: 2010-04-01
Hi all

I want to write a program, which send system key to the window: Alt + Tab, Ctrl + Alt + Del ...
Does any one know how to do? I prefer a sample code.
Thanks in advance.
Question by:melodiesoflife
    LVL 86

    Accepted Solution

    Just see ("SendKeys in C++") which covers exactly that. From the article:

    Here is a small snippet that allows you to send the ALT-TAB sequence:

      // press DOWN "Alt-Tab"
      keybd_event(VK_MENU, 0, 0, 0);
      keybd_event(VK_TAB, 0, 0, 0);


      // stop pressing "Alt-Tab"
      keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
      keybd_event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);

    You'll find the rest there plus some helpful wrapper code also ;o)
    LVL 86

    Expert Comment


    >> Ctrl + Alt + Del

    That one I wouldn't want to emulate if I were you.
    LVL 6

    Author Comment

    Thanks, that is exactly code I'm finding

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
    In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now