Hi,
In have made a program that takes a screen shot of the desktop using the GetDesktop and GetDC APIs. After storing the DC in a long called lngPic I would like to turn this into a bitmap but not save it on the hard disk. Any ideas?
Printable View
Hi,
In have made a program that takes a screen shot of the desktop using the GetDesktop and GetDC APIs. After storing the DC in a long called lngPic I would like to turn this into a bitmap but not save it on the hard disk. Any ideas?
Use BitBlt api to blit it on a picture, which you save with Savepicture
err what do you mean turn it to a bitmap and not save it on the hard drive, by taking the screenshot it is already a bitmap in memory, do you mean get at its bitmap handle? if so you want to use the selectobject, deleteobject and createcompatiblebitmap apis
hope that's what you wanted.Code:Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Public Function BitmapFromDC(ByVal hDC As Long) As Long
Dim retval As Long
retval = SelectObject(hDC, CreateCompatibleBitmap(hDC, 1, 1))
DeleteObject SelectObject(hDC, retval)
BitmapFromDC = retval
End Function
Sorry I wasn't clear with the question Sam Finch but you answered my question brilliantly. Thats exactly what I wanted to know. Thanks
[Edited by rino_2 on 08-11-2000 at 03:42 PM]