Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am simulating Alt+f4 key event from my application.
However it does not seem to work.

Here is the code, please could I get to know what is the issue?
keybd_event( VK_MENU ,0x38,KEYEVENTF_EXTENDEDKEY | 0 ,0);
keybd_event( VK_F4 ,0x3e,KEYEVENTF_EXTENDEDKEY |0, 0 );
keybd_event( VK_F4 ,0x3e,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);
keybd_event( VK_MENU ,0x38,KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,0);


Thanks.
Posted
Updated 16-Dec-10 21:57pm
v2
Comments
Dalek Dave 17-Dec-10 3:57am    
Edited for Grammar and Readability.

1 solution

MSDN says[^]
This function has been superseded. Use SendInput[^] instead.

who says
This function is subject to UIPI. Applications are permitted to inject input only into applications that are at an equal or lesser integrity level.
 
Share this answer
 
Comments
[no name] 17-Dec-10 3:37am    
Good answer, I've actually been looking for this function myself too :)
Dalek Dave 17-Dec-10 3:57am    
Good Call!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900