I'm not sure exactly what you're trying to do so I can't taylor this example but I use Offscreen DCs all the time. They're exactly the same as normal DC's but you can't see them
to create one you can use the following code
Code:
Public Sub CreateDC(WidthInPixels As Long, HeightInPixels As Long, Optional CompatibleDC as Long) As Long
Dim hCompatibleDC As Long
Dim hMemDC as Long
'check there is a compatible DC
If CompatibleDC=0 Then
hCompatibleDC = GetDC(GetDesktopWindow)
Else
hCompatibleDC = CompatibleDC
End If
'CreateDC
hMemDC = CreateCompatibleDC(hCompatibleDC)
'Get Default Bitmap Out of DC and Delete it and Put New one in.
DeleteObject SelectObject(hMemDC, CreateCompatibleBitmap(hCompatibleDC, WidthInPixels, HeightInPixels))
'and We're Done
CreateDC = hMemDC
End Function
This will Create a DC with The Width and Height you Specify, Make sure you always use the DeleteObject SelectObject(hMemDC..... line as the Default Bitmap inside a Memory DC is just a bit. make sure you delete your DC when you've finished otherwise you'll get a memory leak DeleteDC is handy for this.
Oh, here's the API Calls you need
Code:
Private Declare Function CreateCompatibleBitmap Lib "gdi32" Alias "CreateCompatibleBitmap" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" Alias "CreateCompatibleDC" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" Alias "DeleteDC" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" Alias "DeleteObject" (ByVal hObject As Long) As Long
Private Declare Function SelectObject Lib "gdi32" Alias "SelectObject" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
you can just use them like normal DCs