Change of a icon and caption of the Application
The code was tested under OpenGL and DirectX, version OGRE 1.2.2 Dagon, but I think with old versions of problems will not be.
Create file SetMainWindowInfo.h and add next code:
Copy to clipboard
/********************************************************************************** * SetMainWindowInfo.h * Смена значка и имени окна OGRE DirectX и OpenGL [my.name (my.work(a)inbox.ru)] ***********************************************************************************/ #ifndef __SetMainWindowInfo_H__ #define __SetMainWindowInfo_H__ #include "windows.h" #include "resource.h" void g_setMainWindowInfo(char *strWindowCaption, unsigned int uIconResourceID) { HWND hWnd = ::FindWindow("OgreD3D9Wnd", "OGRE Render Window"); if (!::IsWindow(hWnd)) hWnd = ::FindWindow("OgreGLWindow", "OGRE Render Window"); if (::IsWindow(hWnd)) { if (strWindowCaption) ::SetWindowText(hWnd, strWindowCaption); // берем Ð¸Ð¼Ñ Ð½Ð°ÑˆÐµÐ³Ð¾ Ñкзешника char buf[1024]; ::GetModuleFileName(0, (LPCH)&buf, 1024); // берем инÑÑ‚Ð°Ð½Ñ Ð½Ð°ÑˆÐµÐ³Ð¾ Ð¼Ð¾Ð´ÑƒÐ»Ñ HINSTANCE instance = ::GetModuleHandle(buf); // побыÑтрому грузим иконку HICON hIcon = ::LoadIcon(instance, MAKEINTRESOURCE(uIconResourceID)); if (hIcon) { ::SendMessage(hWnd, WM_SETICON, 1, (LPARAM)hIcon); ::SendMessage(hWnd, WM_SETICON, 0, (LPARAM)hIcon); } } } #endif
Now in your project in the beginning add:
Copy to clipboard
#include "SetMainWindowInfo.h"
And at initialization start a method:
Copy to clipboard
g_setMainWindowInfo("ÐœÐ¾Ñ Ð¸Ð³Ñ€Ð°", IDI_MYGAME);
The note: the Icon should be added in resources of the project (in studio of programming).
Добавленно my.name