views:

1580

answers:

3

When I creat a .exe, I can right click it and go to properties->details. Then I get a list like:

File Description | Type | Application File Version | Product Name | Product Version | Copyright | Size | 18.0 KB Date Modified | 6/16/2009 8:23 PM Language |

How do I change these properties? (And on a side note, is there a way to change the icon?)

+6  A: 

If you are using C/Win32 you can add something like this to your project encapsulated in a *.rc (resource) file:

VS_VERSION_INFO VERSIONINFO
 FILEVERSION    0,0,0,2
 PRODUCTVERSION 0,0,0,2
 FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
 FILEFLAGS 0x1L
 #else
 FILEFLAGS 0x0L
 #endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
{
    BLOCK "StringFileInfo"
    { 
        BLOCK "040904b0"
        {
            VALUE "Comments",         "comment\0"
            VALUE "CompanyName",      "comment\0"
            VALUE "FileDescription",  "base file\0"
            VALUE "FileVersion",      "0.0.0.2 TP\0"
            VALUE "InternalName",     "testTP\0"
            VALUE "LegalCopyright",   "none\0"
            VALUE "OriginalFilename", "test.exe\0"
            VALUE "ProductName",      "test\0"
            VALUE "ProductVersion",   "0.0.0.2 TP\0"
        } 
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x409, 1200
    }
}
merkuro
Could you elaborate a little?
Keand64
@Keand64 You find additionally information on MSDN/VERSIONINFO http://msdn.microsoft.com/en-us/library/aa381058.aspx However I can try to shortly describe how it works for me in C (not sure if this is the preferred method in c++, but I didn't now about that you are doing this in C++). I add a resource file (eg. main.rc) to my project, add the code from above and edit it accordingly (see msdn). After a recompile my .exe file contains all the information. If I remember correctly in .NET you can do the same with the [assembly: AssemblyTitle("title")] command.
merkuro
+2  A: 

This is simple file version info resource. For already existent files you can edit this information with any resource editor (for example Resource Hacker, it is outdated but still good). You can change icon this way too.

If you create your own application, then setting it depends on tool you are using. For example in Visual Studio you must look into project properties.

arbiter
+1  A: 
Nick D