I've looked in the Internet, as I always do before asking a question in DIC, but there's a lack of information about it. Asking a question here is always my last resort.
I'm trying to change another executable's icon with no success.
I embedded another icon in my program (there's the main one, and the secondary which will be used as the new icon for another executable) through a .rc file.
Here's the code I'm using:
HANDLE hResource = BeginUpdateResource("user.exe", NULL); HRSRC hRes = FindResource(hInstance, MAKEINTRESOURCE(2), RT_GROUP_ICON); //this finds the embedded icon in my program which has the ID of 2. LoadResource(hInstance, hRes); //this loads the resource found UpdateResource(hResource, RT_GROUP_ICON, MAKEINTRESOURCE(1), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), LockResource(hRes), SizeofResource(hInstance, hRes)); //this updates the icon to the resource EndUpdateResource(hResource, NULL); //this writes the changes back to the executable
BTW, this is my .rc file:
1 ICON "icon.ico" //this is my program's main icon, the one that gets displayed as the executable's image 2 ICON "newicon.ico" //this is the icon to be set as the icon of another executable
There's no error with any of the API calls, but the new executable's icon is null (default icon) after this.