VB 6.0 - LoadPicture Function - Asked By nitu dua on 12-Feb-03 01:12 AM

Hi All,
   I have a vb dll in which i am using printer object to print the documents.I have to print images also , for that i using loadpicture function to load the image then i call PaintPicture function of printer object to print it.But there is some problem in loading picture through dll.My code is working perfectly fine if i run it through std. exe but as i put it in dll it executes each line & every line(even that loadpicture() func) but the picture is not getting displayed.I have tried to use OleLoadPicturePath API for loading the image but it still not working through DLL.
Can anybody suggest how I can do it.

Nitu

LoadPicture Function - Asked By Wladimiro Esposito on 11-Feb-04 05:27 AM

Hi Nitu,
the same thing happened to me.
I’m even tried to append, by code, in the clipboard the image loaded by the LoadPicture method and it is perfect. So it could mean that the LoadPicture function works fine.

The only difference I noticed is that the check ‘Unattended Excecution’ of the .vbp has some influence. Can you try to uncheck that ? Another interesting thing is that the image is displayed if I run the dll in the debug envioment.

Can you tell me something else, please ?
This problem is driven me crazy. Keep in touch.

I'm sorry for my bad English.

Wladimiro

PaintPicture Function - Asked By Wladimiro Esposito on 26-Feb-04 08:43 AM

I have called Microsoft for an MSDN Incident Case.
Microsoft confirmed that this is a BUG.
This function works fine only if
the .dll is called by a Vb Client
otherwise the Bitmap object could not be initialized
in the correct way.

Maybe it will be fixed in VB6 SP6.

PaintPicture Function - Asked By Wladimiro Esposito on 26-Feb-04 08:48 AM

I forgot...

The workaround to avoid the problem 
consist in compiling the code as ActiveX exe
instead of ActiveX dll.