在VC中将客户区图像保存到BMP位图文件
或者jpg文件
只要能保存为图象格式就行?
在vc6.0中怎么写啊????
或者jpg文件
只要能保存为图象格式就行?
在vc6.0中怎么写啊????
解决方案 »
- 为什么消息总是接受2次.
- VC6编译DLL的问题
- VS2010 MFC创建自定义dialog为MDI子窗体的方法,急急急急急......
- 求助:加载一个位图,如何获取某个部分的位图
- 希望路过的高手看看这个程序,线程池都纠结了四天了
- 请教一个程序自动退出的问题
- VC中调用ocx控件时遇到问题,牛人帮忙!!
- _RecordsetPtr m_pRecordset;不用设置它的connection如何直接访问数据库。
- 怎么使程序知道一个窗体是否拥有模态窗体?
- 请问怎么给一个EDIT框自动缩行,比如我按回车后它的下一行自动缩进4个字符,就象VC的编辑环境一样?
- 在DEV-CPP中编译建立快捷方式代码出现incompatible type for argument 1 of `CoCreateInstance'
- 如何实现SDI程序,全屏。
{
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");
}