• 0

[VB6] Load Image from DLL


Question

I have to support an old (OLD!) VB6 app and now management wants to implement encryption for the files. I created a COM DLL in .NET that can encrypt and decrypt the files, and all that works fine. I would like to avoid creating files on the users hard disk, but for most files I simply must do so. However I thought I recalled that I could load an image directly from a DLL in VB6.... and yet I have not been able to find the solution.

My .NET DLL has a function "DecryptImage(sFile as string) as Image" that works fine within another .NET app. But within VB6 I can only find the "LoadPicture()" function and after 90+ minutes I can't find another solution.

Any thoughts?

Link to comment
https://www.neowin.net/forum/topic/944794-vb6-load-image-from-dll/
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  On 11/10/2010 at 19:42, jameswjrose said:

Thanks Omni, however that doesn't work the way I need it too. That API will pull a resource from within the file whereas my function needs to pull an image back from a function within the DLL. Close but not quite.

Again, thank you.

Oh I didn't realize you meant an image as a return result. You'll need to return an HBITMAP (eg. handle to a gdi bitmap) then blit it to the picturebox's surface.

  • 0
  On 11/10/2010 at 21:11, omnicoder said:

Oh I didn't realize you meant an image as a return result. You'll need to return an HBITMAP (eg. handle to a gdi bitmap) then blit it to the picturebox's surface.

Truly not to be snippy, but that's why I included the function I am using in .NET to avoid wasting your time. (no worries)

I have to return an actual image as it's not always used within a PictureBox. It looks like I'm going to have to use the file system to retrieve data. (drats)

Thanks though.

  • 0

Well there's no way to take the Image object from .net straight into VB6 anyway so I was assuming you'd have no problem with changing the return type. You could also use named pipes or memory mapped files, which never need to be saved on the disk.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.