Hi,

I'm quite newbie to asm and completely ignorant of COM. I read at this forum that OleLoadPicture, from OLEPRO32.DLL, could be used to load GIF, JPEG files among other formats. There was an example posted which explained it. Anyway, since I use Nasm, I don't have the facilities provided by Masm and CoLib, so I have to code the real thing and I don't know if I'm doing it well. OleLoadPicture crashes the app.

But what I'd like to know is quite precise:

* Must I use CoInitialize?
* What Dll's should I load, apart from OLEPRO32.DLL?
* The IID_IPicture argument is a pointer to the ClassID data, ok?

I'll appreciate any help regarding this issue. Thanks in advance,
Posted on 2002-03-10 07:59:42 by Wavemaker
Let's go one atr a time:

* Must I use CoInitialize?


Yes. Always call CoInitialize when using simple objects, or OleInitialize to use complete controls, BEFGORE using any COM functions

The only exception is for mempry methods that derive from CoGetMalloc, such as CoTaskMemAlloc.

And before you app ends, call CoUninitialize (or OleUninitialize)

* What Dll's should I load, apart from OLEPRO32.DLL?


I dunno, what DLLs doya got? <grin>

I just played with this method again last night, getting it to load a picture from a program resource. I juat needed the libs for ole32 and oleaut32 (apart from the normal windows DLLs) to get it to compile and link. Here's my full list of incs and libs:



include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\ole32.inc
include \masm32\include\oleaut32.inc
include \masm32\include\gdi32.inc
include \masm32\include\masm32.inc

include \masm32\COM\include\oaidl.inc
include \masm32\COM\include\colib.inc
include IPicture.inc

includelib \masm32\COM\colib\colib.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\ole32.lib
includelib \masm32\lib\oleaut32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\masm32.lib


I needed the masm32 just for the MemCopy method.

* The IID_IPicture argument is a pointer to the ClassID data, ok?


It's a pointer to a GUID structure containing the IID (Interface IDentifier) for IID_IPicture. It's value is:

{7BF80980-BF32-101A-8BBB00AA00300CAB}



I've never used NASM so I can't offer any help with that, but good luck and stop back and let us know how you're doing.
Posted on 2002-03-10 09:48:38 by Ernie