I am trying to use the following code snip but it always get a GPF on the CeateDC
Is the command being used wrong ?
Private Sub ScreenCapture(Left As Long, Top As Long, _
Right As Long, Bottom As Long)
' Captures the specified area of the
' screen to the clipboard.
Dim capWidth As Long, capHeight As Long
Dim SrcDC As Long, DestDC As Long, hBMP As Long
' Calculate capture area size.
capWidth = Right - Left
capHeight = Bottom - Top
' Set up source and destination device contexts.
'SrcDC = CreateDC("DISPLAY", 0, 0, 0) 'Win 95
SrcDC = CreateDC("DISPLAY", vbNullString, vbNullString, 0) 'NT and later ...
DestDC = CreateCompatibleDC(SrcDC)
' Create a bitmap and select it into the destination DC.
hBMP = CreateCompatibleBitmap(SrcDC, capWidth, capHeight)
SelectObject DestDC, hBMP
' Transfer the bitmap from the screen DC to the
' destination DC.
BitBlt DestDC, 0, 0, capWidth, capHeight, SrcDC, Left, _
' Open the clipboard, empty it, then put
' the bitmap on it.
SetClipboardData 2, hBMP
' Clean up.
ReleaseDC 0, SrcDC
' Enable the Save button.
Command1(1).Enabled = True