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 7917281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:05:32+00:00 2026-06-03T15:05:32+00:00

I am trying to get my application to output a key combination ( ALT

  • 0

I am trying to get my application to output a key combination ( ALT + D ) to focus on Internet explorers address bar, but I am having trouble implementing the code needed. I already have a method to pass 1 key:

void GenerateKey(int vk, BOOL bExtended) {

KEYBDINPUT  kb = {0};
INPUT       Input = {0};

/* Generate a "key down" */
if (bExtended) { kb.dwFlags  = KEYEVENTF_EXTENDEDKEY; }
kb.wVk  = vk;
Input.type  = INPUT_KEYBOARD;
Input.ki  = kb;
SendInput(1, &Input, sizeof(Input));

/* Generate a "key up" */
ZeroMemory(&kb, sizeof(KEYBDINPUT));
ZeroMemory(&Input, sizeof(INPUT));
kb.dwFlags  =  KEYEVENTF_KEYUP;
if (bExtended) { kb.dwFlags |= KEYEVENTF_EXTENDEDKEY; }
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1, &Input, sizeof(Input));

return;
}

Can anyone provide some help as to how to achieve a the desired solution ?

SOLUTION:

I managed to solve this issue using the following method:

void GenerateKeyCombination(int vk, int vk2, BOOL bExtended, BOOL bExtended2) {

KEYBDINPUT  kb = {0};
INPUT       Input = {0};
KEYBDINPUT  kb2 = {0};
INPUT       Input2 = {0};

// Generate a "key down" 1
if (bExtended) { kb.dwFlags  = KEYEVENTF_EXTENDEDKEY; }
kb.wVk  = vk;
Input.type  = INPUT_KEYBOARD;
Input.ki  = kb;
SendInput(1, &Input, sizeof(Input));

// Generate a "key down" 2
if (bExtended2) { kb2.dwFlags  = KEYEVENTF_EXTENDEDKEY; }
kb2.wVk  = vk2;
Input2.type  = INPUT_KEYBOARD;
Input2.ki  = kb2;
SendInput(1, &Input2, sizeof(Input2));

// Generate a "key up" 1
ZeroMemory(&kb, sizeof(KEYBDINPUT));
ZeroMemory(&Input, sizeof(INPUT));
kb.dwFlags  =  KEYEVENTF_KEYUP;
if (bExtended) { kb.dwFlags |= KEYEVENTF_EXTENDEDKEY; }
kb.wVk = vk;
Input.type = INPUT_KEYBOARD;
Input.ki = kb;
SendInput(1, &Input, sizeof(Input));

// Generate a "key up" 2
ZeroMemory(&kb2, sizeof(KEYBDINPUT));
ZeroMemory(&Input2, sizeof(INPUT));
kb2.dwFlags  =  KEYEVENTF_KEYUP;
if (bExtended2) { kb2.dwFlags |= KEYEVENTF_EXTENDEDKEY; }
kb2.wVk = vk2;
Input2.type = INPUT_KEYBOARD;
Input2.ki = kb2;
SendInput(1, &Input2, sizeof(Input2));

return;
}

And calling it like so:

        GenerateKeyCombination(0x12, 0x44, FALSE, FALSE);

Where 0x12 is ALT and 0x44 is D.

  • 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-06-03T15:05:35+00:00Added an answer on June 3, 2026 at 3:05 pm

    Add an accelerator map to your project resources,Load it into your application at runtime, and in your message loop add a call to TranslateAccelerator before TranslateMessage and DispatchMessage gets a chance to take a look at it.

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms646373%28v=vs.85%29.aspx for reference.

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

Sidebar

Related Questions

I'm having some trouble trying to get my tweets on the header of my
Im trying to get console output from an external application in my application. When
I'm trying to get an application to pass the Windows 7 Software Logo Toolkit
I am trying to get my ZEND application up on my apache server running
I'm trying to get a CakePHP application to work. For this, I've set up
I am trying to get my Blackberry application to display a custom modal dialog,
I'm trying to get the current application name (the application that contains the current
I'm running CentOS 5, and am trying to get a django application working with
im trying to get the funnelweb blog application to run on my machine, ive
We are trying to get quaqua out of our application. We had been using

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.