Friday 7 June 2019

Simulates the PrintScreen Key - SendKeys implemented in Windows Scripting and Basic languages cannot send PrintScreen key, this program allows the PrintScreen key to be simulated.

This uses the inbuilt compilers in Windows 10 - there are three VB.NET compilers and three C# compilers - just copy each text file into the same folder and double click the batch file to make the program.
REM Compiles PrintScreen.vb to PrintScreen.exe
REM SendKeys implemented in Windows Scripting and Basic languages cannot send PrintScreen key, this program allows the PrintScreen key to be simulated.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\PrintScreen.vb" /out:"%~dp0\PrintScreen.exe" /target:winexe
pause





Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Public Module SendWinKey
    Const KEYEVENTF_KEYDOWN As Integer = &H0
    Const KEYEVENTF_KEYUP As Integer = &H2

    Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger)

Public Sub Main()    
        keybd_event(CByte(Keys.PrintScreen), 0, KEYEVENTF_KEYDOWN, 0) 'press the PrintScreen key down
        keybd_event(CByte(Keys.PrintScreen), 0, KEYEVENTF_KEYUP, 0) 'release the PrintScreen key
End Sub

End Module

No comments:

Post a Comment