void CMyDlg::SaveIcon(HICON hIconToSave, LPCTSTR sIconFileName)
{
if(hIconToSave==NULL || sIconFileName==NULL)
return;
PICTDESC picdesc;
picdesc.cbSizeofstruct = sizeof(PICTDESC);
picdesc.picType = PICTYPE_ICON ;
picdesc.icon.hicon = hIconToSave;
IPicture* pPicture=NULL;
OleCreatePictureIndirect(&picdesc, IID_IPicture, TRUE,(VOID**)&pPicture);
LPSTREAM pStream;
CreateStreamOnHGlobal(NULL,TRUE,&pStream);
LONG size;
HRESULT hr=pPicture->SaveAsFile(pStream,TRUE,&size);
char pathbuf[1024];
strcpy(pathbuf,sIconFileName);
CFile iconfile;
iconfile.Open(pathbuf, CFile::modeCreate|CFile::modeWrite);
LARGE_INTEGER li;
li.HighPart =0;
li.LowPart =0;
ULARGE_INTEGER ulnewpos;
pStream->See
VC通过图标句丙保存ico图标
最新推荐文章于 2020-11-23 23:47:01 发布