I want send shift + Button click event to other process.
I used SendNotifyMessage like this.
while(1)
{
if( g_bSendEvent )
{
sleep(1000);
if( g_dwSubStatus == 0 )
{
SendNotifyMessage(g_hWndMain, WM_KEYDOWN, VK_LSHIFT, 0);
SendNotifyMessage(g_hWndMain, WM_LBUTTONDOWN, MK_LBUTTON, g_lClickPos);
g_dwSubStatus = 1;
}
else if( g_dwSubStatus == 1 )
{
SendNotifyMessage(g_hWndMain, WM_LBUTTONUP, MK_LBUTTON, g_lClickPos);
SendNotifyMessage(g_hWndMain, WM_KEYUP, VK_LSHIFT, 0);
}
}
}
But this doesn’t work.
Button Click Event was send to other process.
Please help.
Tool: VS 2008 , MFC
Don’t use messages! The SendInput function is what you are looking for. (Remember that your process needs to be elevated if you want to send input to another elevated process.)