Home All Groups Group Topic Archive Search About

Form resource files

Author
2 Jun 2006 5:08 PM
Dave Brown
Hi there,

Given an arbitrary ".resx" file (not ."resources"), does anybody know how I
can identify that this file actually contains a Windows form (in code). Once
identified, I then want to collect information about the form and all its
controls. Presumably I would want to read this file into a
"System.Windows.Forms.Form" class so I can obtain the necessary info. How
would I do this. Thanks.in advance.

Author
2 Jun 2006 5:35 PM
Tamas Demjen
Dave Brown wrote:
> Hi there,
>
> Given an arbitrary ".resx" file (not ."resources"), does anybody know how I
> can identify that this file actually contains a Windows form (in code). Once
> identified, I then want to collect information about the form and all its
> controls. Presumably I would want to read this file into a
> "System.Windows.Forms.Form" class so I can obtain the necessary info. How
> would I do this. Thanks.in advance.

There is no form in the .resx file, and no source code either. It only
contains binary resources, such as images and image lists (or other
types of embedded multimedia streams). The form itself and its controls
are always in source code format in the .cpp (or .cs or .vb) file, named
similarly as the .resx but having a different extension. The resource is
just a supplement for those properties that can not be described in
source code.

Tom
Author
2 Jun 2006 6:25 PM
Dave Brown
> There is no form in the .resx file, and no source code either. It only
> contains binary resources, such as images and image lists (or other types
> of embedded multimedia streams). The form itself and its controls are
> always in source code format in the .cpp (or .cs or .vb) file, named
> similarly as the .resx but having a different extension. The resource is
> just a supplement for those properties that can not be described in source
> code.

Thanks for the reply. Well, let me clarify this a little (note BTW that I'm
a very experienced C++ (WinAPI) developer but am fairly new to .NET). As I'm
sure you know, the VS IDE automatically creates a ".resx" file for each form
created in the IDE (and one for each localized version if the form's
"Localizable" property is set to "True"). Now, if I pass this ".resx" file
to the native .NET utility "Winres.exe", it can re-construct (display) the
form based on the "resx" file alone (no other project files need be
present). I need to do the same thing but here's the twist. I'll be
enumerating all ".resx" files in an arbitrary project so as I encounter each
".resx" file, I first need to determine if it is in fact a VS-generated
".resx" file (containing the form's resources). If so then I want to gather
information about the form in code (possibly displaying it) but I'm not sure
how to do this. "Winres.exe" can do it however ((hopefully relying on
documented techniques) but I still can't figure out how (after lots of
digging). Any suggestions? Thanks again.
Author
2 Jun 2006 6:52 PM
GhostInAK
Hello Dave,

It would be a simple matter of decompiling winres.exe (using ILDASM or Reflector)
and seeing exactly how it works.

-Dan

Show quote
>> There is no form in the .resx file, and no source code either. It
>> only contains binary resources, such as images and image lists (or
>> other types of embedded multimedia streams). The form itself and its
>> controls are always in source code format in the .cpp (or .cs or .vb)
>> file, named similarly as the .resx but having a different extension.
>> The resource is just a supplement for those properties that can not
>> be described in source code.
>>
> Thanks for the reply. Well, let me clarify this a little (note BTW
> that I'm a very experienced C++ (WinAPI) developer but am fairly new
> to .NET). As I'm sure you know, the VS IDE automatically creates a
> ".resx" file for each form created in the IDE (and one for each
> localized version if the form's "Localizable" property is set to
> "True"). Now, if I pass this ".resx" file to the native .NET utility
> "Winres.exe", it can re-construct (display) the form based on the
> "resx" file alone (no other project files need be present). I need to
> do the same thing but here's the twist. I'll be enumerating all
> ".resx" files in an arbitrary project so as I encounter each ".resx"
> file, I first need to determine if it is in fact a VS-generated
> ".resx" file (containing the form's resources). If so then I want to
> gather information about the form in code (possibly displaying it) but
> I'm not sure how to do this. "Winres.exe" can do it however
> ((hopefully relying on documented techniques) but I still can't figure
> out how (after lots of digging). Any suggestions? Thanks again.
>

AddThis Social Bookmark Button