Re: Icons on menu[INFO]
- From: "Jon Lewis" <jon.lewis@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 17 Aug 2006 17:01:20 +0100
Hi Tom
I tried this as follows called from VBA code in my Access app:
Dim hMod As Long, hImage As Long
hMod = LoadLibrary(CurrentDBDir & "CustMan.dll")
hImage = LoadImage(hMod, ByVal 101&, IMAGE_ICON, 16, 16, 0)
FreeLibrary hMod
(CurrentDBDir supplies a path)
LoadLibrary and FreeLibrary return correctly but hImage returns 0 with
LastDllError 0 too.
Icon 101 in the res file is known good (loads fine with LoadImage
LR_LOADFROMFILE)
Maybe I created the dll incorrectly:
OpenVB, New ActiveX Dll, Resource Editor - Add Icon
Save resource File, save project
Make dll from main file menu
BTW .lib & .exp files are also created when the Dll is made. Would these
need distributing with the dll (assuming it worked of course!)
TIA
Jon
"Tom Esh" <tjeshGibberish@xxxxxxxxxx> wrote in message
news:49m6e2lgipg5127lrdl6n57uvhun4hjr51@xxxxxxxxxx
On Wed, 16 Aug 2006 12:51:47 +0100, "Jon Lewis"
<jon.lewis@xxxxxxxxxxxxxx> wrote:
Tom
'scuse me for busting in on this thread
I program mainly in MS Access but I use LoadImage alot to load icon files
for use as form icons etc. I either distribute all the many icon files
seperately or store the icons as binary data within the Access MDB/E file
in
which case I'm writing an icon from binary data to file on the hard disk
file before using LoadImage to LOADFROMFILE
I was wondering whether it would be possible to create a res file using vb
containing all my images, wrap that up in a VB executable and then use
LoadImage from a seperate application to load an icon to memory for use by
that application?
Yes, but it would not have to be an exe if that's all you're using it
for. A dll would work just as well, and it would not even need to be
registered if you plan to use strictly Api methods to load the images.
Works like this:
hMod = LoadLibrary("mydll.dll")
hImage = LoadImage(hMod, ByVal 101&, _
IMAGE_BITMAP, 13, 13, 0)
FreeLibrary hMod
Note LoadLibrary, FreeLibrary would not typically be used each time
you load an image, but rather once to wrap all calls to LoadImage.
One thing important to keep in mind is this is only useful if you plan
to use strictly Api methods to manipulate the images.
You could not for example use it to fetch a COM Picture object and
assign it to a control property. For that you're better off building a
COM (registered) dll with a public class and methods to fetch Picture
objects.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
.
- Follow-Ups:
- Re: Icons on menu[INFO]
- From: Tom Esh
- Re: Icons on menu[INFO]
- References:
- Icons on menu[INFO]
- From: giddy
- Re: Icons on menu[INFO]
- From: Tom Esh
- Re: Icons on menu[INFO]
- From: Jon Lewis
- Re: Icons on menu[INFO]
- From: Tom Esh
- Icons on menu[INFO]
- Prev by Date: newbie sendmessage spy++
- Next by Date: Re: Running an exe without bringing up confirmation dialogs
- Previous by thread: Re: Icons on menu[INFO]
- Next by thread: Re: Icons on menu[INFO]
- Index(es):
Relevant Pages
|