Guys, I found that if I put a manifest file named "codeblocks.exe.manifest" with the content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="CompanyName.ProductName.YourApplication"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Along with the codeblocks.exe, then
this issue is GONE. (I'm on WinXP)
I just take several days to find this simple solution.
While debugged, I see we have a file named "x86.manifest" in our src\src\resources, and this file is correctly compiled into the codeblocks.exe. (I just a resource editor to open the codeblocks.exe to verify it).
But what the problem is that, when I debugged the code, I see two instance of "comctrl32.dll" is in the process's space, one is version 5, and the other is version 6, in our x86.manifest, we did require version 6, but I see in our C::B's source code, it still get version 5. The related code is here:
// function to check the common controls version
#ifdef __WXMSW__
#include <windows.h>
#include <shlwapi.h>
bool UsesCommonControls6()
{
bool result = false;
HINSTANCE hinstDll;
hinstDll = LoadLibrary(_T("comctl32.dll"));
if (hinstDll)
{
DLLGETVERSIONPROC pDllGetVersion;
pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hinstDll, "DllGetVersion");
if (pDllGetVersion)
{
DLLVERSIONINFO dvi;
HRESULT hr;
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
hr = (*pDllGetVersion)(&dvi);
if (SUCCEEDED(hr))
result = dvi.dwMajorVersion == 6;
}
FreeLibrary(hinstDll);
}
return result;
}
#else
bool UsesCommonControls6()
{
// for non-windows platforms, return true
// as this is only used for knowing if bitmaps support transparency or not
return true;
}
#endif
This means, the icon issue is caused by using the version 5 of the common ctrl.
After I explicitly put a "codeblocks.exe.manifest" along with the codeblocks.exe, it issue is solved.
Any hints about this? maybe, our "x86.manifest" is wrong.
BTW:
The blurred icon was caused by the remove of the alpha channel from the png file(if C::B can't use the version 6 of the comctrl32.dll), see below:
wxBitmap cbLoadBitmap(const wxString& filename, wxBitmapType bitmapType)
{
// cache this, can't change while we 're running :)
static bool oldCommonControls = !UsesCommonControls6();
wxImage im;
wxFileSystem* fs = new wxFileSystem;
wxFSFile* f = fs->OpenFile(filename);
if (f)
{
wxInputStream* is = f->GetStream();
im.LoadFile(*is, bitmapType);
delete f;
}
delete fs;
if (oldCommonControls && im.HasAlpha())
im.ConvertAlphaToMask();
return wxBitmap(im);
}