PDA

Click to See Complete Forum and Search --> : Getting a Hdc directly from LoadPicture or LoadResPicture


Nircer
Nov 29th, 2000, 07:15 AM
Is there a way to get the Hdc directory from LoadResPicture? Can i cast it, or use it directly as a Hdc? or is there a way to get a Hdc from a image out of a resource file?

If not what it the best way to do it without the loading process being seen?

Fox
Nov 29th, 2000, 09:56 AM
If you want to use LoadPicture check out my tutorial (direct link) (http://orion.spaceports.com/~mccloud/english/coding/tutorial/3.3.html). I dont know about LoadResPicture, but if it loads a iPictureDisp you can use it instead.

Nircer
Nov 29th, 2000, 10:23 AM
Thanks, but found a better way:


Dim X as New StdPicture
set X = LoadPicture("C:\Windows\circles.bmp")

BitBlt X.Hdc, 0, 0, 32, 32, Tile, ActFrame * 32, 0, vbSrcCopy


You can also create an array of StdPicture to store graphics in Memory until you need them.

Nirces
Nov 29th, 2000, 10:48 AM
sorry, change that last line to:


X.Render(Destination:=Picture1.hdc ,xDest:= 0, yDest:= 0, Destwidth:=32, Destheight:=32, xSource:=0, ySource:=0, SourceWidth:=32, SourceHeight:=32, NULL)

It doesn't allow raster operations thou, I might end up uing some of your code :)

Thanks