3

I'm converting some VB6 code to C#. VB6 stores resources in a .frx file, the same way C# stores it in .resx files. How do I convert the images in a .frx file into something that can be embedded in a .resx file?

eglease
  • 2,445
  • 11
  • 18
  • 28
Bryce Wagner
  • 1,151
  • 7
  • 18

2 Answers2

10

Here's a partial answer -- There is a utility program available to do the extraction part.

GfxFromFrx: How to extract graphics from VB binary property files

by Brad Martinez.

example of utility in action

It will extract resources in whatever format they are in - icon, bitmap, cursor, etc. and save to individual files.

The original location of this utility was here: site and code zip.

It may no longer exist, but an archive is located here: site and code zip.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
6

In the .frm file, it contains lines like this:

    Image = "blah.frx" : 1234

The string is the file (obviously), and the numbers are a hexadecimal offset to the image. There's a 12 byte header at that location, and the last 4 bytes of that header contain the length of the image in bytes. The image itself immediately follows the 12 byte header.

Converting to a .resx is just calling Convert.ToBase64String() on that image.

Bryce Wagner
  • 1,151
  • 7
  • 18