May 03, 2024, 11:22:08 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Bitmaps and resources

Started by LarryMc, August 30, 2008, 08:12:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

This question is directed to Sapero but anyone can answer.

Sapero,
About 3 years ago, in a ListView program you used the following to load a bitmap, scaling it as it loaded:
hBitmap2 = LoadImageA(0, getstartpath+"images\\b1.bmp", IMAGE_BITMAP, w,h, LR_LOADFROMFILE)
The scaling is an undocumented feature of the LoadImage command (supposedly only works for Icons and Cursers)
The command above works great for me.

However, I want the bitmaps to be in a resource.
I have a bitmap in a resource with an ID of 201.
I want to load it with the scaling just like with the external bitmap.
I tried this without success:
hBitmap2 = LoadImageA(0, "201", IMAGE_BITMAP, w,h, 0)and thishBitmap2 = LoadImageA(0, MAKEINTRESOURCE(201), IMAGE_BITMAP, w,h, 0)
Don't know what else to try.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Larry,

The first parameter has to be the instance handle to the executable or DLL that you are loading the resource from.

hInstance = GetModuleHandle(0)

Returns the instance handle of the running executable. 

A quick look at the sources, or MSDN docs that I gave you a link to, would have given you the answer as well.

Paul.
Ionic Wind Support Team

LarryMc

Quote from: Paul Turley on August 30, 2008, 09:10:15 PM
A quick look at the sources, or MSDN docs that I gave you a link to, would have given you the answer as well.

I looked; looked; and looked somemore at all that.
That doesn't mean it registers or means anything to me. ;)

Thanks for taking the time.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Yep,

This did it; scaling and all.
hInstance = _GetModuleHandle(0)
hBitmap2 = LoadImageA(hInstance, "#201", IMAGE_BITMAP, w,h, 0)


Thanks again

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library