Hi to Every body, I have a question about loading a JPEG image from a file and displaying it on a window; I being searching the web for accouple hours but have not found too much, all i know is the windows has a build-in librery called Ole32.dll and Ole32pro.dll that have a few functions for this, the must important functions are: CreateStreamOnHGlobal and OleLoadPicture with does two and some more you should be able to do it, but I don't know how to use them and I don't have the value for IID_IPicture variable, I found a sample in http://ourworld.compuserve.com/home...ies_world/a.htm but is made for MASM not FASM and FASM doesn't have coinvoke macro and the .if macro doesn't work (but that's not a big problem).

What I'm trying to do is include the JPEG file in the resource section and then use the LoadBitmap to get the image handle and then pass it to CreatePatternBrush to create a brush with the image to use it as a Window default background; here is the code for that (it works but only with BMP files).

invoke LoadBitmap,,IDB_ASSIGN
invoke CreatePatternBrush,eax
mov ,eax

Posted on 2003-02-13 18:37:10 by alonso
I see your new and willing to search first ;)

So i will point out this board also has a good search engine in it. This link was found in a seach on this board:


It has pretty well all your looking for... Ernie has alread been down this road a couple of times :alright:

Posted on 2003-02-13 22:44:48 by NaN
NaN is right: Ernie wrote a library called ImageLib, IIRC that loads gif, jpeg, etc...
There is an example in the latest MASM32 package...
Posted on 2003-02-14 00:54:00 by JCP
Also my SOL Raytracer (find it with sourcecode in Games Programming forum section) has a routine that loads JPEG and temporary paints it over window (for testing) ... the routine is in \jpeg subfolder in TASM style but i am sure you can convert it easy to MASM or FASM . Based on Ernie's research :)
Posted on 2003-02-14 01:39:24 by BogdanOntanu
look at the algorithms thread, i posted a method to load a jpeg from a resource and return a bitmap handle to it.


hope this helps
Posted on 2003-02-14 02:24:23 by Terab
alonso: there is a "comcall" macro for FASM that does the same job as "coinvoke", you can find it in the DDraw example in FASMW package.
Posted on 2003-02-16 15:43:41 by Tomasz Grysztar