Win32 Resources in .NET Question

  • Thread starter Thread starter Christopher Burr
  • Start date Start date
C

Christopher Burr

I'm trying to retrieve a string resource from a Win32 file.

In win32 world I would just use LoadLibrary and LoadString.

What do I use in the .NET world?
 
Christopher,

If you are working with the new resource model in .NET, then you will
want to take a look at the classes in the System.Resources namespace
(specifically ResourceManager for culture-specific resources). Also, you
can include resources directly into your app that are not culture specific.
You just have to add the file to your project, and set the Build Action
property of the file to "Embedded Resource". If you do that, you can then
call GetManifestResourceStream on the Assembly that represents your
assembly, passing in the project name, and then the name of the file. If
your project was named "Project1", and the file was named "MyFile1.txt",
then you would pass "Project1.MyFile1.txt" to GetManifestResourceStream.

Hope this helps.
 
No what I'm trying to do is grab resource ID 1 out of the file ss3dfo.scr,
which is a win32 file. Need to know how to read the PE resources in .NET

--
Chris Burr
(e-mail address removed)


Nicholas Paldino said:
Christopher,

If you are working with the new resource model in .NET, then you will
want to take a look at the classes in the System.Resources namespace
(specifically ResourceManager for culture-specific resources). Also, you
can include resources directly into your app that are not culture specific.
You just have to add the file to your project, and set the Build Action
property of the file to "Embedded Resource". If you do that, you can then
call GetManifestResourceStream on the Assembly that represents your
assembly, passing in the project name, and then the name of the file. If
your project was named "Project1", and the file was named "MyFile1.txt",
then you would pass "Project1.MyFile1.txt" to GetManifestResourceStream.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Christopher Burr said:
I'm trying to retrieve a string resource from a Win32 file.

In win32 world I would just use LoadLibrary and LoadString.

What do I use in the .NET world?
 
Christopher,

In this case, you will want to call the same API functions you would in
an unmanaged application, as I don't believe there is support in the
framework for them.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Christopher Burr said:
No what I'm trying to do is grab resource ID 1 out of the file ss3dfo.scr,
which is a win32 file. Need to know how to read the PE resources in .NET

--
Chris Burr
(e-mail address removed)


message news:[email protected]...
Christopher,

If you are working with the new resource model in .NET, then you will
want to take a look at the classes in the System.Resources namespace
(specifically ResourceManager for culture-specific resources). Also, you
can include resources directly into your app that are not culture specific.
You just have to add the file to your project, and set the Build Action
property of the file to "Embedded Resource". If you do that, you can then
call GetManifestResourceStream on the Assembly that represents your
assembly, passing in the project name, and then the name of the file. If
your project was named "Project1", and the file was named "MyFile1.txt",
then you would pass "Project1.MyFile1.txt" to GetManifestResourceStream.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Christopher Burr said:
I'm trying to retrieve a string resource from a Win32 file.

In win32 world I would just use LoadLibrary and LoadString.

What do I use in the .NET world?
 
Back
Top