如何在Visual C ++中以编程方式更改程序图标?我的IDE是Visual Studio 2013。
我想将Icon更改为嵌入式资源图标。你知道该怎么办吗?
答案 0 :(得分:1)
using System.Runtime.InteropServices;
..
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam);
struct IconHandler
{
internal const uint WmSeticon = 0x80u;
internal const int IconSmall = 0x0;
internal const int IconBig = 0x1;
}
private void Form1_Load(object sender, EventArgs e)
{
InitializeComponent();
//Properties.Resources.Icon.Handle is just an .*ico file in your resources. Icons can have different sizes.
SendMessage(Handle, IconHandler.WmSeticon, IconHandler.IconSmall, Properties.Resources.Icon.Handle);
SendMessage(Handle, IconHandler.WmSeticon, IconHandler.IconBig, Properties.Resources.Icon.Handle);
}
答案 1 :(得分:0)
如果要更改Microsoft Visual Studio C ++的程序图标,您可以:
Right Click Visual Studio 2013
1.Click "Properties"
2.Click the sub-tab "Shortcut"
3.Click "Change Icon"
4.Browse or select from the list below
完成!