Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Visual Basic Programming Code Examples

Visual Basic > Code Snippets Code Examples

Capture desktop window

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Capture desktop window Private Const SRCCOPY = &HCC0020 Private Const BLACKNESS = &H42 Private Const SRCERASE = &H440328 Private Const SRCINVERT = &H660046 Private Const SRCPAINT = &HEE0086 Private Const WHITENESS = &HFF0062 Private Const DSTINVERT = &H550009 Private Const MERGECOPY = &HC000CA Private Const MERGEPAINT = &HBB0226 Private Const NOTSRCCOPY = &H330008 Private Const NOTSRCERASE = &H1100A6 Private Const PATCOPY = &HF00021 Private Const PATINVERT = &H5A0049 Private Const PATPAINT = &HFB0A09 Private Const SRCAND = &H8800C6 Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Sub Form_Load() Dim dwnd As Long, wndc As Long Form1.AutoRedraw = True dwnd = GetDesktopWindow() wndc = GetDC(dwnd) BitBlt Me.hdc, 0, 0, Screen.Width, Screen.Height, wndc, 0, 0, SRCCOPY End Sub