Windows resources and windres
Windows resources and windres
A general good introduction to windows resources can you get from Colin
Peters . Nowadays is it simpler to create a dll with dllwrap than the
method he describe and several new tools has come to get the symbols from
dlls and .libs. But it still a very good introduction.
If you just want to have a icon and some menus is it easy to create
the .rc resource file with a simple text editor and let windres compile
it to something that can be linked into your program. More fancy stuff
is harder and some kind of visual editor can be useful. The lcc compiler
has such a resource editor and it can be downloaded from the lcc
page or as a separate download from the vide
page .
All works well as long you restrict yourself to self made resource files.
Compiling resource scripts from other programs can be harder. The first
step is to update the windres tool from the latest
unofficial release. Sample code often come with both .rc and
.res files the .res can mostly be compiled. If nothing works do you have
to edit the .rc file. Here is some common problems and some solutions :
lower case keyword
The error messages is often that windres can not open a font file but the
error is lower case keywords such as begin, end, icon, menu and so on.
missing commas
This gives a parse error. Here is a example:
MENUITEM "Set Capture &File..."
IDM_F_SETCAPTUREFILE
is missing the comma after " so it should be altered to
MENUITEM "Set Capture &File...", IDM_F_SETCAPTUREFILE
missing include files
Not much to do about this but one can always try to comment out the include.
illegal lists
I do not have a good name to describe this. You get a parse error because
the syntax is too relaxed for windres. One common example:
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VERSIONCOMPANYNAME
VALUE "FileDescription", VERSIONDESCRIPTION
VALUE "FileVersion", VERSIONSTR
VALUE "InternalName", VERSIONNAME
VALUE "LegalCopyright", VERSIONCOPYRIGHT
VALUE "OriginalFilename", VERSIONNAME
VALUE "ProductName", VERSIONPRODUCTNAME
VALUE "ProductVersion", VERSIONSTR
END
BLOCK "041104E4"
BEGIN
VALUE "CompanyName", VERSIONCOMPANYNAME
VALUE "FileDescription", VERSIONDESCRIPTION
VALUE "FileVersion", VERSIONSTR
VALUE "InternalName", VERSIONNAME
VALUE "LegalCopyright", VERSIONCOPYRIGHT
VALUE "OriginalFilename", VERSIONNAME
VALUE "ProductName", VERSIONPRODUCTNAME
VALUE "ProductVersion", VERSIONSTR
END
END
Must be changed to this:
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VERSIONCOMPANYNAME
VALUE "FileDescription", VERSIONDESCRIPTION
VALUE "FileVersion", VERSIONSTR
VALUE "InternalName", VERSIONNAME
VALUE "LegalCopyright", VERSIONCOPYRIGHT
VALUE "OriginalFilename", VERSIONNAME
VALUE "ProductName", VERSIONPRODUCTNAME
VALUE "ProductVersion", VERSIONSTR
END
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "041104E4"
BEGIN
VALUE "CompanyName", VERSIONCOMPANYNAME
VALUE "FileDescription", VERSIONDESCRIPTION
VALUE "FileVersion", VERSIONSTR
VALUE "InternalName", VERSIONNAME
VALUE "LegalCopyright", VERSIONCOPYRIGHT
VALUE "OriginalFilename", VERSIONNAME
VALUE "ProductName", VERSIONPRODUCTNAME
VALUE "ProductVersion", VERSIONSTR
END
END
icons in dialogs
windres seems to have problems with icons in dialogs but if you change
the type does it works
back to main Open GL page
|