how can i create a memory DC for Graphics?
when i draw the bitmap, the bitmap isn't drawed :(
i know these, because when i get pixel a pixel, i only get the black color
Code:
Public Sub Class_Initialize()
GDIsi.GdiplusVersion = 1&
GdiplusStartup gToken, GDIsi
'hDC = CreateCompatibleDC(GetDC(0))
GdipCreateFromHWND GetForegroundWindow(), hGraphics
GdipGetDC hGraphics, hDC
If (hDC = 0) Then MsgBox "error"
If Err Then
Err.Clear
Exit Sub
ElseIf gToken = 0& Then
Exit Sub
End If
End Sub
Code:
Public Function FromFile(FileName As String) As Boolean
If FileName = "" Then Exit Function
If hGraphics Then
Call GdipLoadImageFromFile(StrPtr(FileName), hBitmap)
If hBitmap Then
GdipGetImageHeight hBitmap, ImageHeight
GdipGetImageWidth hBitmap, ImageWidth
FromFile = True
GdipDrawImage hGraphics, hBitmap, 0, 0
End If
End If
End Function