none
How to change .EXE icon

    Question

  • I have my Test.exe file. I want to change the icon of Test.exe file from another Proj.exe file.
    I am trying somewhat like this but it dosent work

            hExe=LoadLibrary("Test.exe");
            if(hExe==NULL)
                MessageBox(hwnd,"Fail:Load","Fail",0);
            hRes=FindResource((HMODULE)hExe,"Test.ico",RT_ICON);
            if(hRes==NULL)
                MessageBox(hwnd,"Fail:Find","Fail",0);

    It shows error while finding the icon resource. I tried

    hRes=FindResource((HMODULE)hExe,MAKEINTRESOURCE(107),RT_ICON);

    or

    hRes=FindResource((HMODULE)hExe,"IDI_TEST",RT_ICON);

    but still it dosent work.
    How can I find the icon resource of Test.exe file.
    Monday, March 03, 2008 10:17 AM

Answers

  • Hi,

     

    Would you please get extended error information through calling GetLastError? This error message is helpful analyzing.

     

    Generally, FindResource fails if the resource doesn’t exist in the module. Thus, you can open “Test.exe” with Visual Studio. Open it as file and its resources will be automatically displayed. And then check whether an icon resource with ID 107 exists in it.

     

    Hope this helps!

     

    Thursday, March 06, 2008 10:28 AM