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

  • Home
  • SEARCH
  • 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 965539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:00:53+00:00 2026-05-16T02:00:53+00:00

Ok so I might be totally barking up the wrong tree here as I’m

  • 0

Ok so I might be totally barking up the wrong tree here as I’m not that up to date on Windows programming but here goes.

I’m trying to initiate a simulated keypress in a C++ project in Visual Studio 2010.

Essentially when the program receives a specific code string from another application (which is all being worked via many if statements, messy but works)

I need it to perform the same function as if I pressed control and s on my keyboard.

Now some code I found was this.

keybd_event(VK_LCONTROL,0,0,0); 
  keybd_event(bKey, 0, 0, 0);


   keybd_event(bKey, 0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_LCONTROL,0,KEYEVENTF_KEYUP,0); 

Whereby bKey is the appropriate ASCII code for S, it escapes me off hand but still, it’s mostly irrelevant to this post.

What this should do by my understanding of it is

Push Control down
Push S down
Release S
Release Control.

However it does not seem to do this, it seems to only push down and release S thereby printing S as appropriate or not depending if text entry is available at the time.

Am I barking up the wrong tree altogether here? I know how to do this in Objective C in Xcode but the two seem quite radically different, I know they’re different systems but still.

Can anyone propose a solution to this? Basically a way to make the program hit Control + S together (not one after the other, together).

Any help is much appreciated. There seems to be a lot of conflicting information out there.

  • 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. Editorial Team
    Editorial Team
    2026-05-16T02:00:54+00:00Added an answer on May 16, 2026 at 2:00 am

    Try this instead:

    keybd_event(VK_LCONTROL,MapVirtualKey(VK_LCONTROL,0),0,0); 
    keybd_event(bKey, MapVirtualKey(bKey,0), 0, 0);
    
    
    keybd_event(bKey, MapVirtualKey(bKey,0), KEYEVENTF_KEYUP, 0);
    keybd_event(VK_LCONTROL,MapVirtualKey(VK_LCONTROL,0),KEYEVENTF_KEYUP,0); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to mocking so I might have it totally wrong here but
OK, I'm guessing that this might be a bug but I'm not totally sure.
Okay I might be entirely off track now but here goes: Our webshop offers
I might be going about this in totally the wrong way but this is
Be aware that I might be doing this totally wrong, so I apologize in
I might be doing something totally wrong, but i created a simple test schema:
Might be a bit of noob question but it's something that's been getting me
It might look like a stupid question, but I recently realized that .NET implementation
Initial Warning : Long post and I might have got the pattern totally wrong
I might be totally confused and off target here. I have an Event model,

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.