image packing

obot74639
09-02-2003, 09:53 AM
is there a way to pack images into a dll, where I can call them from an application in Visual Basic and create the dll in VB also? I want ot be able to use it from multiple applications, and reference the images from a named system.
thanks

OnErr0r
09-02-2003, 09:56 AM
Compile a resource file into the dll. You could make methods using native vb functions LoadResPicture/LoadResData/LoadResString to return images from the dll, or use various apis to get images from it. LoadImage, LoadString etc.

amadare
10-15-2003, 03:54 PM
Compile a resource file into the dll. You could make methods using native vb functions LoadResPicture/LoadResData/LoadResString to return images from the dll, or use various apis to get images from it. LoadImage, LoadString etc.

Is there anything special you have to reference to get the info from the .res inside the dll? I tried this route and always get the error "326" "resource not found"

Right now I am doing nothing but calling

LoadResData(numString, "CUSTOM")

If I add the .res right to my .exe project it works fine, but with it compiled into the .dll project and the dll referenced in my .exe project it gives me that error.

TIA
amadare

OnErr0r
10-16-2003, 02:28 PM
You'll need to write code in your DLL to return an StdPicture object containing the image. Then instantiate an instance of the dll and call the method that returns the image.

amadare
10-17-2003, 07:47 AM
You'll need to write code in your DLL to return an StdPicture object containing the image. Then instantiate an instance of the dll and call the method that returns the image.

So, rather than put my ShowPicture() sub (which includes the LoadResData call) in the .exe, put that in the dll and then when called from the .exe the picture should show up? Lemme know if I followed you.

TIA
amadare

OnErr0r
10-17-2003, 10:42 AM
So, rather than put my ShowPicture() sub (which includes the LoadResData call) in the .exe, put that in the dll and then when called from the .exe the picture should show up? Lemme know if I followed you.

TIA
amadare

Correct.


' In dll:

Public Function ShowPicture(ByVal lIndex As Long, Byval eConst As LoadResConstants) As StdPicture
Set ShowPicture = LoadResPicture(lIndex, eConst)
End Sub

' In Exe:

Set Picture1.Picture = ShowPicture(101, vbResBitmap)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum