可先获得AutoCAD窗口指针acedGetAcadFrame(),再调用SetIcon ()函数,见下面的swicon()函数:
#include "StdAfx.h"
#include "StdArx.h"
#include "resource.h" //此处要添加本h文件,才能使用IDI_ICON1
// This is command 'SWICON'
// 更改AutoCAD窗口的图标
int swicon()
{
// TODO: Implement the command
resbuf* pArg = acedGetArgs();
CMDIFrameWnd *pFrame;
pFrame=acedGetAcadFrame();
HICON m_icon;
ASSERT(hIcon);
m_icon=AfxGetApp()->LoadIcon(IDI_ICON1);
pFrame->SetIcon(m_icon,FALSE);
pFrame->UpdateWindow ();
return RTNORM;
} |