Skip to main content

History: Change of a icon and caption of the Application

Preview of version: 3

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

русскоязычный сайт по OGRE

History

Information Version
Sat 02 of Jan, 2010 23:20 GMT-0000 jacmoe 5
Sat 02 of Jan, 2010 23:19 GMT-0000 jacmoe 4
Thu 31 of Dec, 2009 14:04 GMT-0000 jacmoe 3
Fri 25 of Dec, 2009 19:40 GMT-0000 jacmoe 2
Sun 12 of Oct, 2008 17:46 GMT-0000 OgreWikiBot Robot: Cosmetic changes 1