代码
// 获取 BMP 文件的数据
HBITMAP hBmp = (HBITMAP)LoadImage(NULL, _T("d:\\123.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (hBmp == NULL) {
acutPrintf(_T("Failed to load BMP file\n"));
return;
}
// 打开剪贴板
if (!OpenClipboard(NULL)) {
acutPrintf(_T("Failed to open clipboard\n"));
return;
}
// 清空剪贴板
EmptyClipboard();
// 将 BMP 图像数据设置到剪贴板
if (!SetClipboardData(CF_BITMAP, hBmp)) {
acutPrintf(_T("Failed to set clipboard data\n"));
CloseClipboard();
return;
}
// 关闭剪贴板
CloseClipboard();
ads_point pt;
if(RTNORM != acedGetPoint(NULL,_T("\n指定插入点: "),pt))
{
return;
}
acedCommand(RTSTR,_T("_pasteclip"),RT3DPOINT, pt,RTNONE);