long lHandle;
int nWidth;
int nHeight;
int nFormat;
CString flName;
CFile fl;
try{
fl.Open(flName,CFile::modeCreate|CFile::modeWrite);
PUCHAR pBuf;
int nBufLen;
if(!xxxx(nWidth,nHeight,nFormat,&nBufLen))
MessageBox("Alloc memory failed!!!");
pBuf=new UCHAR[nBufLen];
if(fl!=NULL)
{
if(xx(lHandle,nWidth,nHeight,nFormat,pBuf,NULL,&nBufLen))
{
fl.Write(pBuf,nBufLen);
fl.Close();
}
else
{
AfxMessageBox("Failed to capture bitmap");
}
}
主要是文件操作怎样改啊.我在delphi下write方法不对啊,大家帮帮我吧.
int nWidth;
int nHeight;
int nFormat;
CString flName;
CFile fl;
try{
fl.Open(flName,CFile::modeCreate|CFile::modeWrite);
PUCHAR pBuf;
int nBufLen;
if(!xxxx(nWidth,nHeight,nFormat,&nBufLen))
MessageBox("Alloc memory failed!!!");
pBuf=new UCHAR[nBufLen];
if(fl!=NULL)
{
if(xx(lHandle,nWidth,nHeight,nFormat,pBuf,NULL,&nBufLen))
{
fl.Write(pBuf,nBufLen);
fl.Close();
}
else
{
AfxMessageBox("Failed to capture bitmap");
}
}
主要是文件操作怎样改啊.我在delphi下write方法不对啊,大家帮帮我吧.
解决方案 »
- For循环有Step?
- 如何在桌面画坐标系???急,急,急高分求解.
- 简单问题给高分啊,越快越好
- 为了更好的学习delphi,想找一个讨论delphi的群加入,有哪位好心人推荐个群给我,这样我问问题可以方便点,谢谢
- 在Delphi 中如何远程启动‘sql server'的'服务管理器'
- ★怎样在继承的时候(即inherited的时候),传递一个参数给父类过程?具体内详。
- 怎样做这个控件啊?帮帮我了!
- sql server 求助!!!!
- csdn 的asp有问题了吗?
- 我写一个COM组件在自动类中用到了这个:varArraycreate([0,FContentLength],varByte);编译过程中提示:Undeclared identifer:'vararraycreate'请问是否需要在USES中包含特别的单元?
- 类似泡泡的一个小游戏,请大哥们帮帮我!!!给我一个思路啊~~
- 按两次增加按钮才能增加一空行:DBEDIT与DBGRID的问题????急
pBuf:Pchar;
Open应该改为Create吧
xx,xxxx又是什么,没有见过
lHandle: THandle;
nWidth: Integer;
nHeight: Integer;
nFormat: Integer;
flName: String;
fl: Windows.HFILE;
pBuf: PCHAR;
nBufLen: Integer;
i: Dword;
begin
try
fl := CreateFile(flName,GENERIC_WRITE,0,nil,CREATE_ALWAYS,0,0); if not (xxxx(nWidth,nHeight,nFormat,@nBufLen)) then
MessageBox('Alloc memory failed!!!'); GetMem(pBuf,nBufLen);
//pBuf := new UCHAR[nBufLen];
if fl <> nil then
begin
if xx(lHandle,nWidth,nHeight,nFormat,pBuf,NiL,@nBufLen) then
begin
WriteFile(fl,pBuf^,nBufLen,i,nil);
closehandle(hFile);
end
else
begin
AfxMessageBox('Failed to capture bitmap');
end
end
MessageBox('Failed to capture bitmap');