473,651 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load resource from DLL

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

Yoav.
Feb 25 '07 #1
2 6206
This assumes the "external dll" is a managed assembly named
"AssemblyResour ces.dll". The code shown uses the GetManifestReso urceNames
method to load the first resource, convert to Bitmap, and display in a
Picturebox:

Assembly asm = Assembly.LoadFr om(System.Envir onment.CurrentD irectory +
@"\AssemblyReso urces.dll");
Stream strm =
asm.GetManifest ResourceStream( (string)asm.Get ManifestResourc eNames()[0]);
Bitmap b = (Bitmap)Image.F romStream(strm) ;
pictureBox1.Ima ge = b;
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


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

Yoav.
Feb 25 '07 #2
The external DLL is unmanaged DLL.

"Peter Bromberg [C# MVP]" <pb*******@yaho o.yabbadabbadoo .comwrote in
message news:F8******** *************** ***********@mic rosoft.com...
This assumes the "external dll" is a managed assembly named
"AssemblyResour ces.dll". The code shown uses the GetManifestReso urceNames
method to load the first resource, convert to Bitmap, and display in a
Picturebox:

Assembly asm = Assembly.LoadFr om(System.Envir onment.CurrentD irectory +
@"\AssemblyReso urces.dll");
Stream strm =
asm.GetManifest ResourceStream( (string)asm.Get ManifestResourc eNames()[0]);
Bitmap b = (Bitmap)Image.F romStream(strm) ;
pictureBox1.Ima ge = b;
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


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

Yoav.

Feb 26 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1011
by: Bob Clegg | last post by:
Hi, ..net Win app. Installed on Win2000 server client machine (Non Domain controller member of a domain.) When operator logs on locally with local admin priviliges it works. When operator logs on locally with no admin priviliges or logs onto domain with domain administrator rights it gives the above message when initialising. The app is an Oracle database client with the database residing on the domain controller in case this is...
1
1416
by: Lou | last post by:
How do I load resource(bitmaps, icons) from a resource file? -Lou
0
1132
by: Arjen | last post by:
Hello, I'm using VS.NET 2003, VB.NET. My project structure is like this: myAppName (root) | - resources | - resources.resx
2
1503
by: Maileen | last post by:
Hi, I'm used under C++ to write a DLL which contain all my resource strings used in my application. I would like to continue in this way under VB.NET. Please, could you tell me how to create a DLL in which i will store all my resource strings ? I don't want to use the assemblies ou special resource string delivered with VB.NET. I really want to use my old way to do it, using the winapi32 to load, read and lock dll file.
9
2830
by: Alf P. Steinbach | last post by:
<what to design a C++ solution for> A Windows API /resource/ is data embedded in the executable, accessed via API functions. A resource is completely identified by the quadruple (id, type, language, file), where (1) id is what, for want of a better name, I'll call a /kludgeon/, (2) type is also a kludgeon, (3) language is a small integer identifying a concrete national language or one of a set of pseudo-languages such as the Windows...
0
1091
by: poojo hackma | last post by:
How can I load a System Resource image into a PictureBox with the CLR? Code: //----------------------------------------- System::Windows::Forms::PictureBox^ PictureBox1; System::IO::Stream^ resource; System::Void Button_Click(System::Object^ sender, System::EventArgs^ e) { resource = Assembly::GetManifestResourceStream("Fido.jpg");
0
2084
by: Achim Domma | last post by:
Hi, I try to develop a localized Asp.Net 1.1 application. I have added two resource files to my app, which are called 'Labels.resx' and 'Labels.de.resx'. If I compile the app, I see a 'de' subfolder in my 'bin' folder and the folder contains the resource dll. Accessing the german strings does not work. After a lot of debugging I managed to get fuslogvw.exe to work and got a result like this:
4
4463
by: msnews.microsoft.com | last post by:
I am writing my first managed project and I am a bit confused in loading resource strings. In old unmanaged C++ if I had a resource string in my rc file called GX_ERR_DEVICE_ALREADY_OPEN. I would simply call: int LoadString(HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax );
12
5261
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.