隨筆-17  評論-64  文章-79  trackbacks-1
          void ? SaveBmp(HBITMAP ? hbmp, ? LPCTSTR ? sIconFileName)???
          { ?
          ? if(hbmp==NULL ? || ? sIconFileName==NULL) ?
          ? return; ?
          ? //warning: ? this ? code ? snippet ? is ? not ? bullet ? proof. ?
          ? //do ? error ? check ? by ? yourself ? [masterz] ?
          ? PICTDESC ? picdesc; ?
          ? picdesc.cbSizeofstruct ? = ? sizeof(PICTDESC); ?
          ? picdesc.picType ? = ? PICTYPE_BITMAP ? ; ? ? ? ? ?
          ? picdesc.bmp.hpal ? = ? NULL; ?
          ? picdesc.bmp.hbitmap ? = ? hbmp; ?
          ? 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->Seek( ? li,STREAM_SEEK_SET,&ulnewpos); ?
          ? ULONG ? uReadCount ? = ? 1; ?
          ? while(uReadCount>0) ?
          ? { ?
          ? ?
          ? pStream->Read(pathbuf,sizeof(pathbuf),&uReadCount); ?
          ? if(uReadCount>0) ?
          ? iconfile.Write(pathbuf,uReadCount); ?
          ? } ?
          ? pStream->Release(); ?
          ? iconfile.Close();???
          }???
          ????
          void ? CsaveviewView::OnSaveview()???
          { ?
          ? CClientDC ? dc(this); ?
          ? CDC ? dcmem; ?
          ? dcmem.CreateCompatibleDC(&dc); ?
          ? CBitmap ? bmp; ?
          ? CRect ? rc; ?
          ? GetClientRect(&rc); ?
          ? bmp.CreateCompatibleBitmap(&dc,rc.Width(),rc.Height()); ?
          ? dcmem.SelectObject(&bmp); ?
          ? dcmem.BitBlt(0,0,rc.Width(),rc.Height(),&dc,0,0,SRCCOPY); ?
          ? SaveBmp(bmp,"c:\\a.bmp");???
          ?}
          posted on 2007-02-23 21:08 飛鳥 閱讀(452) 評論(0)  編輯  收藏 所屬分類: VC
          主站蜘蛛池模板: 汉沽区| 漳州市| 北碚区| 达孜县| 屏山县| 海原县| 怀宁县| 信宜市| 德江县| 桓仁| 手机| 安国市| 嘉义县| 得荣县| 镇雄县| 大新县| 布拖县| 南昌市| 海伦市| 福贡县| 全州县| 宝应县| 正蓝旗| 汉阴县| 兴宁市| 平泉县| 加查县| 瑞金市| 新营市| 三明市| 县级市| 钦州市| 河西区| 柘荣县| 邵东县| 吉首市| 松潘县| 南江县| 上思县| 阳东县| 华宁县|