Load resource from DLL

Y

Yoavo

Hi,
In my application I need to load a bitmap which exists on an external DLL.
How do I do it ?

Yoav.
 
G

Guest

This assumes the "external dll" is a managed assembly named
"AssemblyResources.dll". The code shown uses the GetManifestResourceNames
method to load the first resource, convert to Bitmap, and display in a
Picturebox:

Assembly asm = Assembly.LoadFrom(System.Environment.CurrentDirectory +
@"\AssemblyResources.dll");
Stream strm =
asm.GetManifestResourceStream((string)asm.GetManifestResourceNames()[0]);
Bitmap b = (Bitmap)Image.FromStream(strm);
pictureBox1.Image = b;


-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
 
Y

Yoavo

The external DLL is unmanaged DLL.

Peter Bromberg said:
This assumes the "external dll" is a managed assembly named
"AssemblyResources.dll". The code shown uses the GetManifestResourceNames
method to load the first resource, convert to Bitmap, and display in a
Picturebox:

Assembly asm = Assembly.LoadFrom(System.Environment.CurrentDirectory +
@"\AssemblyResources.dll");
Stream strm =
asm.GetManifestResourceStream((string)asm.GetManifestResourceNames()[0]);
Bitmap b = (Bitmap)Image.FromStream(strm);
pictureBox1.Image = b;


-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Yoavo said:
Hi,
In my application I need to load a bitmap which exists on an external
DLL.
How do I do it ?

Yoav.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top