What is the ImageID? Pointer? hBitmap?

Just starting out? Need help? Post your questions and find answers here.
Paul Dwyer
User
User
Posts: 44
Joined: Wed Nov 05, 2003 4:34 am
Location: Tokyo, Japan

What is the ImageID? Pointer? hBitmap?

Post by Paul Dwyer »

I want to create a DLL that loads a png or jpg and passes this back to the calling application. This application might not be a PB app so I need to know how to use this number.

So, I have a number returned by LoadImage, it's global so it can be passed back but what is it?

An hDC, hBitmap, Pointer to array of bytes?

If it's some sort of PB proprietry internal ID then how can I get the handle or something standard to pass back to the calling application so it can use it?

Thanks
Paul Dwyer
Network Engineer
Aussie in Tokyo
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

If #PB_Any is passed to LoadImage then you will get an PB internal ID only. You can now use the ImageID() Command to get the handle of the picture.

Mike
Tranquil
Paul Dwyer
User
User
Posts: 44
Joined: Wed Nov 05, 2003 4:34 am
Location: Tokyo, Japan

Thanks1, but still confused

Post by Paul Dwyer »

The LoadImage docs say

Load the specified image. If #PB_Any is used as '#Image' parameter, the new image identifier will be returned as 'Result'. The image can be in BMP, icon or any other format supported by the ImagePlugin library. If the function fails, 0 is returned, else all is fine. The following commands can be used to enable automatically more image formats:

So I have a "Image Identifier"

Then the ImageID() docs say:

Returns the ImageID of the current Image.

The numbers they return are not the same so ImageID is different from "Image Identifier" :?: :?: Docs are as clear as mud :?

Either way, I don't seem to be able to use either number as a valid Bitmap handle (or is that not what you meant by "picture handle" ? )

I just want to be sure that I'm dealing with the right types of data in API calls in the other app before spending hours on trying to debug other issues with them
Paul Dwyer
Network Engineer
Aussie in Tokyo
Paul Dwyer
User
User
Posts: 44
Joined: Wed Nov 05, 2003 4:34 am
Location: Tokyo, Japan

Made Some Progress

Post by Paul Dwyer »

It seems that

StartDrawing(ImageOutput())

Will pass me an hDC to the pic and if I pass that the new app can BitBlt off the hDC to get the data and it works. I suspect there are more operations happening here than necessary though. ImageOutput() seems to deliver me yet another type of image ID and I don't know if it's usable or not.

So while this works it's a little clunky, it would be greate to know what the following are:

Image Identifier
ImageID (as returned in ImageID() )
ImageOutput()
StartDrawing is an hDC though :)
Is there a way to get an hBITMAP?
Paul Dwyer
Network Engineer
Aussie in Tokyo
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

LoadImage() used with #PB_Any returns a pb specific number. (to be used for other image commands like CopyImage(), UseImage(), ...)

LoadImage() used with another number as the #Image parameter returns HBITMAP (this is for backwards compatibility)
(in this case you use this passed #Image value for CopyImage(), ...)

ImageID() returns a HBITMAP

ImageOutput() returns yet another PB internal value that can ONLY be used in StartDrawing()

StartDrawing() returns, as you figured out, a HDC.
quidquid Latine dictum sit altum videtur
Post Reply