Change exe external icon at runtime

I am developing a simple application that should just copy another existing executable and change its icon . Can this be done with .NET? I ask about changing the icon, copying is not a problem.

I have no clues on how and where to start. I searched on Google, but found only unmanaged C ++ code that I am not very familiar with.

Nothing happens in this message with a change in the current application icon at run time, but with a change in the icon of an external application (visible in Windows Explorer).

Any help would be appreciated.

Thank.

+3
source share
2 answers

.NET has no support for this. The icon is saved in unmanaged resources embedded in .exe. You can see them using File + Open + File, select .exe and open the node icons. The icon with the lowest number is the one that uses Windows.

Updating these resources usually requires a .exe recovery. Fortunately, the Windows API supports updating resources on the fly. This has limitations, but it should not affect you for the icons. You will need BeginUpdateResource, UpdateResource and EndUpdateResource. Remember that they are not easy to use, you need to know the resource number of the icon. Visit pinvoke.net for the ads you need.

+7
source

'Assuming you are using Visual Studio / Visual C # Express Edition.

Project > Your App Properties. "" "" , .

-3

Source: https://habr.com/ru/post/1770383/


All Articles