Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:27:38+00:00 2026-05-11T03:27:38+00:00

I am pretty sure the following button-activated form code should raise a Control-F12 in

  • 0

I am pretty sure the following button-activated form code should raise a Control-F12 in my C# application:

SendKeys(‘^{F12}’);

But it does not appear to go on up to the windows shell and activate another program that is listening for it. My keyboard does work. It seems like the sendkeys is getting intercepted somewhere and not sent on in a way that actually simulates the key stroke. Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:27:39+00:00Added an answer on May 11, 2026 at 3:27 am

    SendKeys is not capable of sending keys outside of the active application.

    To really and truly simulate a keystroke systemwide, you need to P/Invoke either keybd_event or SendInput out of user32.dll. (According to MSDN SendInput is the ‘correct’ way but keybd_event works and is simpler to P/Invoke.)

    Example (I think these key codes are right… the first in each pair is the VK_ code, and the second is the make or break keyboard scan code… the ‘2’ is KEYEVENTF_KEYUP)

    [DllImport('user32.dll')] private static extern void keybd_event(byte bVk, byte bScan,     int dwFlags, int dwExtraInfo);  ...  keybd_event(0xa2, 0x1d, 0, 0); // Press Left CTRL keybd_event(0x7b, 0x58, 0, 0); // Press F12 keybd_event(0x7b, 0xd8, 2, 0); // Release F12 keybd_event(0xa2, 0x9d, 2, 0); // Release Left CTRL 

    The alternative is to activate the application you’re sending to before using SendKeys. To do this, you’d need to again use P/Invoke to find the application’s window and focus it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty sure that many people have thought of this, but for some reason
I have the following code that should, when run, update a table of victims
I'm pretty sure this is a really fundamental concept in Python, I'd love it
I was pretty sure that the answer to that question was, Never, ever can
I am using the following array: NSMutableArray *buttonNames = [NSMutableArray arrayWithObjects:@button1, @button2, @button3, nil];
I am trying to use SIP to do 3rd party Call Control. I am
The following question is a good rundown on what the spec says about the
I have a Magento site in which there are about 20-25 extensions installed, among
I want to be able to have a JPanel in a cell with a
Suppose I'm making a new library, Jokes, with a small API. In the interest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.