CatchImage Function

Just starting out? Need help? Post your questions and find answers here.
Vater
User
User
Posts: 18
Joined: Fri Dec 17, 2004 8:52 am

CatchImage Function

Post by Vater »

Hello NG,

I use the API ExtractIcon to get the handle of an icon File stored in a Exe File. Can I use CatchImage to create an Image Object in Memory and then Save it.
Here is how I try it

lngRetValue = ExtractIcon_(0, strCompleteFilename, 2)
If lngRetValue <> 0
CatchImage(0, lngRetValue)
SaveImage(lngRetValue, strZielverzeichnis + "\" + strFilename + ".bmp")
EndIf

Unfortunately this doesn't work. I thet a ReturnValue form the _ExtractIcon Function but i'm not able to catch the image with it.
Do I misunderstand the CatchImage function?

Thanks in advance

Stefan
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

You could do it this way...

Code: Select all

strCompleteFilename.s="x:\test.exe"

lngRetValue = ExtractIcon_(0, strCompleteFilename, 0)

If lngRetValue
  CreateImage(1,32,32)
  StartDrawing(ImageOutput())
    DrawImage(lngRetValue,0,0)
  StopDrawing()

  SaveImage(1, "test.bmp")
EndIf
Image Image
Post Reply