troubleshooting Question

PostMessage() to send three keys to a window

Avatar of elorc
elorcFlag for United States of America asked on
.NET ProgrammingC#
4 Comments1 Solution1029 ViewsLast Modified:
I'm not entirely sure how to do this properly. I'm trying to send the keystroke CTRL-SHIFT-M to a window using PostMessage. How do I specify this with the function though? IIRC, to send CTRL-M (for example) I'd just use:

int kDown = PostMessage(hWnd, WM_KEYDOWN, VK_M, VK_CONTROL);
int kUp = PostMessage(hWnd, WM_KEYUP, VK_M, VK_CONTROL);

However that code doesn't seem to work. But how do I do this with the full CONTROL-SHIFT-M keystroke instead?

Long story short, there's a "Help" link on an application that I'm developing for my office. When the user clicks this link, I want it to open a new mail window in Outlook and fill out the To and Subject lines, then move the cursor to the body field so they can type their message... although I'm obviously not that far along yet. :)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros