LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate a Print Screen keyboard press

I would like to simulate a Print Screen keyboard button press in the code so a screen shot is pasted to the system clipboard. 
 
Any input would be appreciated.
0 Kudos
Message 1 of 3
(4,349 Views)
Hello Paul,
 
This piece of code works for me:
 
 keybd_event (VK_SNAPSHOT, 0, 0, 0);                                             // Simulate button press.
 keybd_event (VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0);           // Simulate button release.
 
Check the MSDN Library for more information on the keybd_event function.
 
Almost forgot this: don't forget to add the "#include <windows.h> " line on top of your code!
 
Success,
Wim

Message Edited by Wim S on 03-14-2007 06:22 PM

Message 2 of 3
(4,342 Views)
Thank you, the commands worked beautifully.
0 Kudos
Message 3 of 3
(4,327 Views)