Understanding How to Properly use SendMessage.

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
Im creating a program that allows me to send multiple commands to some unix shell windows.
One thing I dont understand is how to properly send a combination of characters.

For example, if I were to send a Ctrl-V, the shell should show me "^V", however, when I do this:


<div style="color:Black;background-color:White; <pre>
SendMessage((<span style="color:Blue; int)hWnd, WM_KEYDOWN, VK_CTRL, 1);  <span style="color:Green; //press control

SendMessage((<span style="color:Blue; int)hWnd, WM_KEYDOWN, VK_V, 1); <span style="color:Green; //press v

SendMessage((<span style="color:Blue; int)hWnd, WM_KEYUP, VK_V, 1); <span style="color:Green; //let go of v

SendMessage((<span style="color:Blue; int)hWnd, WM_KEYUP, VK_CTRL, 1); <span style="color:Green; //let go of control
[/code]
<br/>

<br/>

I see "vv" as if the control key didnt matter and Im guessing that the keyup is also sending a v. Now, I know that sending:
<br/>


<br/>


<div style="color:Black;background-color:White; <pre>
SendMessage((<span style="color:Blue; int)hWnd, WM_KEYDOWN, 0x16, 1);
[/code]
<br/>

<br/>

will give me that effect, but I dont understand where 0x16 comes from when the hex value for the VK_V (virtual key V) is 0x56.
Can someone shed some light here?
<br/>

Thanks in advance for all responses.
<br/>




View the full article
 
Back
Top