Putting a Picture back into a surface
Does anyone know if it is Possible to Get a picture from a directDraw surface so that I can use its HDC to manipulate it then put it back when im done? The whole point of this is to rotate the surface, so if anyone knows of a procedure or something to do that instead I would be greatful. I already have a procedure to rotate an image but I need to use the HDC number because it uses the SetPixel and GetPixel APIs.
This is what I have so far, Temp and Temp2 are local variables of type PictureBox:
Code:
Set temp = frmMain.Picture1 'The Surface will be loaded into here
Set temp2 = frmMain.Picture2 'The Rotated Image will end up in here
temp2.Cls
TheSurface.BltToDC temp.hdc, srcRect, srcRect
RotatePicture temp.hdc, temp2.hdc, ang, ... 'This works fine, rotates Temp.hdc and places result in temp2.hdc
Set TheSurface = DDraw.GetSurfaceFromDC(temp2.hdc) 'Place the image back in the surface.
The only problem is that this dont work. I get an automation error on the last line ie. "Set TheSurface = ..."
Thanx for any help.