OptimizedHotkey Example for Visual Basic

Private WithEvents LEADScrCap1 As LEADRasterScr

Private Sub Form_Load()
    Set LEADScrCap1 = New LEADRasterScr
End Sub

Private Sub Command1_Click()
    'set cancel key to ESC
    LEADScrCap1.CaptureCancelKey = vbKeyEscape
    
    'set hotkey
    LEADScrCap1.CaptureHotKey = vbKeyF11
    
    'enable optimized hotkey
    LEADScrCap1.OptimizedHotkey = True
    
    'start the captures
    LEADScrCap1.CaptureActiveWindow
End Sub

Private Sub LEADScrCap1_OnCaptureImage(ByVal CaptureNumber As Long)
    'get the captured image here
    LEADRasterView1.Raster.Bitmap = LEADScrCap1.Bitmap
End Sub