Send CTRL + V via PostMessage

2

Hello, I need to send the combination of CTRL + V clicks via POSTMESSAGE. I tried to do this:

 PostMessage(h,WM_KEYDOWN,VK_CONTROL,0);
 PostMessage(h,WM_KEYDOWN,VK_V,0); (Ele da erro nessa linha diz que o VK_V não existe)
 PostMessage(h,WM_KEYDOWN,VK_CONTROL,1);
 PostMessage(h,WM_KEYDOWN,VK_V,1);

What can I be doing wrong?

    
asked by anonymous 11.06.2014 / 16:52

2 answers

2

You can do this by sending the message WM_PASTE to to handle window like this:

 
var
  appHandle: HWND;
begin
 appHandle := FindWindow(nil, 'TitulodaJanela');
 if appHandle = 0 then // Se não encontrou a janela
   exit; 
 PostMessage(appHandle, WM_PASTE, 0, 0);
    
11.06.2014 / 21:06
1

According to the site , there is no constant for the alphabetic keys, so use the hexadecimal value directly.

In case, to simulate pressing the V key use the value 0x56.

    
11.06.2014 / 17:01