PDA

View Full Version : How Set Icon To Exe File



METEOR7
20th November 2011, 13:32
How I Set Icon To Exe File

Please Example (No External URL)

Thanks:o

Oleg
20th November 2011, 14:45
Create resource file in Visual Studio and in your .pro file specify it:


win32 {
RC_FILE = icons/winicon.rc
}


Here's .rc file sample from my project for you, if you do not want to use VS:


// Microsoft Visual C++ generated resource script.
//

#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//

// Generated from the TEXTINCLUDE 2 resource.
//

#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//

// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "application.ico"

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.\0"
END

3 TEXTINCLUDE
BEGIN
"\r\0"
END

#endif // APSTUDIO_INVOKED

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO

FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,0
FILEFLAGSMASK 0x3fL

#ifdef _DEBUG
FILEFLAGS 0x29L
#else
FILEFLAGS 0x28L
#endif

FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L

BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000904b0"
BEGIN
VALUE "Comments", "Application"
VALUE "CompanyName", "Company"
VALUE "FileDescription", "Application"
VALUE "FileVersion", "1, 1, 0, 0"
VALUE "InternalName", "application"
VALUE "LegalCopyright", "Copyright © 2011 Company"
VALUE "OriginalFilename", "application"
VALUE "PrivateBuild", "0"
VALUE "ProductName", "Application"
VALUE "ProductVersion", "1, 1, 0, 0"
VALUE "SpecialBuild", "0"
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x9, 1200
END
END
#endif // Russian resources

/////////////////////////////////////////////////////////////////////////////

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED


resource.h:


//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by winicon.rc
//

// Next default values for new objects
//

#ifdef APSTUDIO_INVOKED

#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif

#endif

METEOR7
20th November 2011, 15:50
Very Thanks
Mr.Oleg

Your Solution is Best:)

ChrisW67
21st November 2011, 01:09
This is in the Qt docs: Setting the Application Icon for the major desktop operating systems and Symbian.