dcandygmailcom

Utility to simulate pressing the printscreen key which Basi

Feb 6th, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.97 KB | None | 0 0
  1. REM 2 files follow
  2. REM PrintScreen.bat
  3. REM This file compiles PrintScreen.vb to PrintScreen.exe using the system VB.NET compiler.
  4. REM Simulates pressing the printscreen key which Basic's SendKeys cannot do.
  5. C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc "%~dp0\PrintScreen.vb" /out:"%~dp0\PrintScreen.exe" /target:winexe
  6. pause
  7.  
  8.  
  9. -------------------------------------------------
  10.  
  11. 'PrintScreen.vb
  12. Imports System.Runtime.InteropServices
  13. Imports System.Windows.Forms
  14.  
  15. Public Module SendPrtScnKey
  16.     Const KEYEVENTF_KEYDOWN As Integer = &H0
  17.     Const KEYEVENTF_KEYUP As Integer = &H2
  18.  
  19.     Declare Sub keybd_event Lib "User32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger)
  20.  
  21. Public Sub Main()    
  22.         keybd_event(CByte(Keys.PrintScreen), 0, KEYEVENTF_KEYDOWN, 0) 'press the PrintScreen key down
  23.         keybd_event(CByte(Keys.PrintScreen), 0, KEYEVENTF_KEYUP, 0) 'release the PrintScreen key
  24. End Sub
  25.  
  26. End Module
Advertisement
Add Comment
Please, Sign In to add comment