Why are you not using hdc for SavedPictures(PicCount).DC? I think you might be trying to save to memory? If so create an array of memory dc objects and use those. Should be lots of examples here. Otherwise you can't assign a dc to something that isn't an object. SavedPics appears to be user defined and you must define it somewhere, right? Post more info.
You can do this, but you'll have to create those dc's first. If you use the function below and store the result in your array you can use them. But be sure to delete the dc's when the program closes using the DeleteDc api.
Code:
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Function GenerateDc(iWidth As Variant, iHeight As Variant) As Long
Dim MyDc As Long
Dim hBitMap As Long
MyDc = CreateCompatibleDC(Me.hdc)
hBitMap = CreateCompatibleBitmap(Me.hdc, iWidth, iHeight)
SelectObject MyDc, hBitMap
GenerateDc = MyDc
End Function
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.