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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:52:17+00:00 2026-06-14T16:52:17+00:00

I am writing an application that sends keystrokes to another application using SendMessage .

  • 0

I am writing an application that sends keystrokes to another application using SendMessage.

[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);

I have been experimenting with the various arguments and I have noticed that, depending on which keystroke I am sending, I have to pass in different arguments to the parameter int Msg.

For example, I have the following defined as possible values for Msg.

private static ushort WM_SYSKEYDOWN = 0x0104;
private static ushort WM_CHAR = 0x0102;
private static ushort WM_KEYDOWN = 0x0100;

and the following test keys that are passed in to the 3rd parameter wParam:

private static ushort VK_F1 = 0x70;
private static ushort VK_A = 0x41;
private static ushort VK_TAB = 0x09;

When I want to send the F1 key (VK_F1) it only works whenever is use WM_SYSKEYDOWN, when I want to send the A key it only works when I use WM_CHAR, and when I want to send the TAB key it only works when I use WM_KEYDOWN.

My question is: is there some documentation out there that tells me when to use WM_KEYDOWN, WM_SYSKEYDOWN, etc. based on what key that is being sent? Or perhaps I am doing it wrong and there is one consistent method that works for any key?

  • 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-14T16:52:18+00:00Added an answer on June 14, 2026 at 4:52 pm

    Microsoft explains the difference between these WM messages here Keyboard Input (Windows).

    WM_SYSKEYDOWN simulates system commands like ALT + TAB used to switch windows.

    WM_CHAR simulates user input like input in a text box for instance.

    WM_KEYDOWN is usually used together with WM_KEYUP. See WM_KEYDOWN message (Windows).

    Most probably you will want to use WM_CHAR.

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

Sidebar

Related Questions

I'm writing a small (C#) client application that sends data using a TCP/IP connection
I am writing an application that sends commands to a unix shell. I am
Writing a client application that sends images to a server via a webservice. As
I'm writing a WinForms application that sends email messages (like a mail merge). I'd
I'm currently writing an application using Vala that requires me to send data over
I'm writing an application that sends files over network, I want to develop a
I'm writing an application in classic ASP (yes, please forgive me) that sends e-mails
I am writing an application that sends command line commands to a 3rd party
I'm writing an application that sends requests to the PHP CLI. However, as i
I am writing an application using Sencha Touch that will require a login to

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.