|
-
September 7th, 2004, 09:05 AM
#1
Changing the icon of a window
Hi Gurus
I'trying to make an exe to change the icon of the window of an other application.
Here my code :
#include "stdafx.h"
#include <winbase.h>
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
HWND hWnd;
HICON hIcon;
// AUDROS (5.5) is the title of the window of I want to change the icon
hWnd = FindWindow(NULL, "AUDROS (5.5)");
if (hWnd)
{
hIcon = (HICON)LoadImage(NULL, "ico00001.ico", IMAGE_ICON, 16, 16, LR_LOADFROMFILE);
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIconSmall);
}
return(0);
}
It really change the icon but as soon as the window is activate, the new icon is lost and it's replace with a defaut icon !!!
Any helps
Thanks
Chris
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
|