hi people,
is there a way to use a jpg image inside a resource file as a bmp image?
and then assign that jpg image to a image control?
is a bmp image the only format i can use?
thanks
Posted on 2004-06-14 14:17:58 by Rammstein
Hutch's masm32 library provides very usefull image handling functions. You can check this one:



BitmapFromResource proc hModule:DWORD, lpName:DWORD

Description
BitmapFromResource returns a bitmap handle from a program resource.
An image may be in either .bmp, .gif, [B].jpg[/B], or .wmf format
Posted on 2004-06-14 14:22:59 by Vortex
Familiarize yourself with the board's search feature :)
http://www.asmcommunity.net/board/index.php?topic=16817&perpage=15&highlight=jp*g%20resource&pagenumber=1

PS: there's probably a bug in those routines, the CreateStreamOnHGlobal is done with "release memory on release" set to true, but the pGlobal is still freed manually. This will cause crash on NT4...
Posted on 2004-06-14 14:23:56 by f0dder
That bug also relates to Ernie's BitmapFromResource, included in the masm32 library. It depends on BitmapFromMemory...

line 85: invoke CreateStreamOnHGlobal, pGlobal, TRUE, ADDR pStream
line 113: invoke CoTaskMemFree, pGlobal

- this is a double free!

Not to mention that these routines, for simplicity, keep calling CoInitialize + CoUninitialize, it's smarter to do this only at startup+shutdown of your application.

On a related note, stay away from the "shell" routine in masm32, it keeps polling GetExitCodeProcess (without any Sleep), which results in 100% CPU usage (I assume that's the reason the install.exe from the recent masm32, m32v82r, makes your system so unresponsive while waiting for the makelib batch to finish). Also, it does not close the process and thread handles in the PROCESS_INFORMATION structure, leading to kernel mode object leak.

In general, be a bit careful with the masm32 stuff - it's not as optimized or safe as one could wish, and hutch is reluctant to fix bugs.
Posted on 2004-06-14 14:30:41 by f0dder