Jump to content

Recommended Posts

Posted

I have 12 command buttons on a form and I try to put small images near them. I can insert the 12 images but that way the images are part of the program. Is it possible to have the images somehow compiled (in a DLL file?) and to instruct VBA to take the images from there? I wish the user to be able to change the images before runs the program just by replacing that file containing the images.

Oh, and I would ned the help at very beginer level

Can someone help me?

Many thanks!

Posted

I believe compiling bitmap resources to a dll would be the most efficient way to provide the initial images . . . . VB6 would be required for that compilation task, however. This also means that even with VB6 available at design time, the ability to change or add additional images to that dll would not be available to users from VBA at run time.

 

Another possible option, though probably requiring more code, would be to store the initial images as individual files in the DVB project’s folder. When the Form is first initialized, code could run to determine the DVB’s own path and load the appropriate images. Additional code would be required to give the end user the ability to modify the images.

 

I’ve never employed either method of external image resource (I usually just make them part of the program) but the process does sound interesting. I’ll investigate further in the coming week, even just to satisfy my own curiosity.

Posted
. . . the ability to change or add additional images to that dll would not be available to users from VBA at run time.

 

Actually, that’s not entirely true. I should add that the free program ResourceHacker (http://angusj.com/resourcehacker/) would also allow users without VB6 the ability to modify a resource dll. It would have to be done outside of the VBA form, though.

Posted

Thank you for answering!

There is no need for the user to modify the DLL file; the program should read the images from it. If he replaces the DLL with a new one (named the same), when he starts the program will see the new images.

Now, can you please write me how to read a specific image from a DLL containing 12 bitmaps?

I just learnt some VB from here and there (mostly from the internet) but I never vent so deep.

Posted

Hi Fuccaro,

 

I’m having limited success with assigning the dll resource images to a VBA form. So far, I’ve collected all the necessary api call to read the images from the dll, but a VBA form does seem to expose the appropriate handles to use for image assignment.

 

I set up a test project with four images (see attached). As it currently stands, it reads the first most image into memory and can easily be assigned to AutoCAD, as the host application, but getting it on the form is proving difficult (see attached image).

 

It seems like VBA forms have been hobbled compared to their VB6 counterparts. :huh: I’ll keep looking around to see if anything new turns up.

 

Sean

InAction.jpg

ImgResProjFiles.zip

Posted

Well, many thanks for your time!

I work on a program and I try put nice looking images near the buttons. But for colorblind persons I wish to provide high contrast images and I thought the DLL file would be the way to go; the same program with different faces for different people.

I still try myself but as I said before, my VB(A) is *so* limited :(

Posted
. . . . VB(A) is *so* limited :(

 

No doubt.

 

VB.NET has a lot more to offer but, unfortunately, a lot more of a learning curve as well.

Posted

Ha ha!

Nice way to quote my words! :)

 

Anyway... could you write me how to do it in VB? Possible it will take me closer to the solution

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...