|
-
July 24th, 2004, 08:18 PM
#1
Change EXE's icon; not so easy
I was given this workspace with many projects; I said I could change the icon of the Executable. Easy I thought (and said to my friend), just find the RC file and make the appropriate changes.
Not so easy, their is no .RC file, no resources at all, so I had to forget the LoadIcon( hWnd, MAKEINTRESOURCE( IDC_MY_ICON ) );
Even adding a "resource | icon" simply added a "ico" file in the project tree.
-> So how can I change the icon of the EXE displayed in explorer (and shortcuts)?.
I did found a WinMain, but it is one like I never saw before. Basicly I have only the hInstance, Here is the code:
Code:
S32 PASCAL WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, S32)
{
Vector<char *> argv;
char moduleName[256];
GetModuleFileName(NULL, moduleName, sizeof(moduleName));
argv.push_back(moduleName);
for (const char* word,*ptr = lpszCmdLine; *ptr; ) {
// Eat white space
for (; dIsspace(*ptr) && *ptr; ptr++)
;
// Pick out the next word
for (word = ptr; !dIsspace(*ptr) && *ptr; ptr++)
;
// Add the word to the argument list.
if (*word) {
int len = ptr - word;
char *arg = (char *) dMalloc(len + 1);
dStrncpy(arg, word, len);
arg[len] = 0;
argv.push_back(arg);
}
}
winState.appInstance = hInstance;
S32 retVal = run(argv.size(), (const char **) argv.address());
for(U32 j = 1; j < argv.size(); j++)
dFree(argv[j]);
return retVal;
}
If you are wondering this is from "GarageGames" Torque 3D engine, my friend is making a small game just for fun (he is not a professional coder, but a real good amateur).
This might help, the "winState" structure (but I am not sure of the initialization order ....)
Code:
struct Win32PlatState
{
FILE *log_fp;
HINSTANCE hinstOpenGL;
HINSTANCE hinstGLU;
HINSTANCE hinstOpenAL;
HWND appWindow;
HDC appDC;
HINSTANCE appInstance;
HGLRC hGLRC;
DWORD processId;
S32 desktopBitsPixel;
S32 desktopWidth;
S32 desktopHeight;
U32 currentTime;
Win32PlatState();
};
Win32PlatState winState;
Any insight appreciated ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|