• 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.
  • Posts

    • Amarok 3.3 Beta 2 replaces Phonon API with GStreamer by David Uzondu Audio players come and go, but one of the long-standing pack leaders is Amarok, a KDE project that has been around since 2003. This player was an essential application for anyone who ran a KDE 3 system, mostly because its interface was simple and did not get in your way. After spending some time in hibernation following the 2.x series, development has picked up again. Now we have version 3.3 Beta 2, bringing some changes under the hood. The most important of which is a complete overhaul of the audio engine. The developers have ditched the old Phonon multimedia framework on Qt6 and reworked everything to use GStreamer instead. The developers have also partially restored CUE sheet support, which is fantastic news for anyone who keeps albums as single audio files. ReplayGain logic has been improved to apply a default fallback value for tracks without loudness data, helping to even out the volume. Some work was also done to prevent potential database issues that could happen during library scans. This release also finalizes some major changes that were introduced in the first beta, as outlined below: Dropping support for Qt5 and KDE Frameworks 5 entirely. It is Qt6 from here on out. Updating the database character set to allow full UTF-8 values, which is great for international music collections. Fixing a year 2038 bug for dates stored in the database. Removing TagLib extras support, which affects RealMedia and Audible files. Now, before you rush off to install it, there are a couple of things to know. Because the first beta updated the database schema, downgrading from this beta back to an older version is not really possible unless you manually backed up your music library first. Also, if you are a big Last.fm user, its official library has not caught up with the Qt6 world yet. You will need a specific build from a repository like this one to get those features working for now. If you are feeling adventurous and want to try the new beta, you will probably have to build it yourself. For that, you can check out the project on GitLab for the source code and guidance. Some Linux distributions might also package the beta in their testing or unstable repositories, so it is worth a look there, too. You can grab the latest stable version of Amarok on Linux via FlatHub.
    • Yeah, stable and consistent data-harvesting to secure you and your 801 partners bottom line...thanks but no thanks.
    • The ethical thing for MS to do (a foreign concept) would be to continue full support for WIndows-10; until WIndows-11 is stable and mature enough to be considered reliable. Give users the ability to get decent use out of hardware they have bought, that MS decided are no longer able to run WIndows-11.
    • Why should users give up using a relatively stable OS (after almost a decade from its initial release) and move to a Beta+ level OS? Maybe in four or five more years, when it finally becomes more stable. Oh, and we have finally gotten fair use out of the hardware we bought, only to have MS say "toss it."
  • Recent Achievements

    • Rising Star
      Phillip0web went up a rank
      Rising Star
    • One Month Later
      Epaminombas earned a badge
      One Month Later
    • One Year In
      Bert Fershner earned a badge
      One Year In
    • Reacting Well
      ChrisOdinUK earned a badge
      Reacting Well
    • One Year In
      Steviant earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      545
    2. 2
      ATLien_0
      205
    3. 3
      +FloatingFatMan
      170
    4. 4
      Michael Scrip
      150
    5. 5
      Som
      131
  • Tell a friend

    Love Neowin? Tell a friend!