fuccaro Posted May 25, 2009 Posted May 25, 2009 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! Quote
SEANT Posted May 25, 2009 Posted May 25, 2009 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. Quote
SEANT Posted May 25, 2009 Posted May 25, 2009 . . . 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. Quote
fuccaro Posted May 25, 2009 Author Posted May 25, 2009 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. Quote
SEANT Posted May 26, 2009 Posted May 26, 2009 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. I’ll keep looking around to see if anything new turns up. Sean ImgResProjFiles.zip Quote
fuccaro Posted May 26, 2009 Author Posted May 26, 2009 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 Quote
SEANT Posted May 27, 2009 Posted May 27, 2009 . . . . 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. Quote
fuccaro Posted May 27, 2009 Author Posted May 27, 2009 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 Quote
Recommended Posts
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.