#if 1
LONG32 CMochaDLLSampleDlg::DownloadImage(ULONG32 lCam, ULONG32 ulObjHandle)
{
ULONG32 nPicSize;
UINT16 uiPicType;
PBYTE pBuff;
LONG32 lRet = RES_SUCCESS; nPicSize = ImageSize(ulObjHandle);
uiPicType = ImageType(ulObjHandle);
TRACE2("OnImageReady: %d\t0x%08x.\n", lCam, nPicSize); m_TransferProgress.SetRange32(0, nPicSize);
pBuff = new BYTE[nPicSize];
#ifdef _USE_MOCHA_CALLBACKS
lRet = GetImage(lCam, ulObjHandle, pBuff, nPicSize, 0, ImageTransferProgress, this);
#else
lRet = GetImage(lCam, ulObjHandle, pBuff, nPicSize, 0);
#endif if (lRet == RES_SUCCESS) {
CString strFileName(*__argv);
int i = strFileName.ReverseFind(_T('\\'));
if (i >= 0) 
strFileName = strFileName.Left(i + 1);
else 
strFileName = _T("");
switch (uiPicType) {
case OBJ_FORMAT_TIFF:
strFileName += _T("picture.tif");
break;
case OBJ_FORMAT_RAW:
strFileName += _T("picture.orf");
break;
case OBJ_FORMAT_EXIF:
default:
strFileName += _T("picture.jpg");
}
CFile f(strFileName, CFile::modeCreate | CFile::modeWrite);
f.Write(pBuff, nPicSize);
f.Close();
}
delete [] pBuff; return lRet;
}
#endif// this version of DownloadImage illustrates using GetImageHeader and GetImage
// to download the picture.
#if 0
LONG32 CMochaDLLSampleDlg::DownloadImage(ULONG32 lCam, ULONG32 ulObjHandle)
{
ULONG32 nPicSize, nHeaderSize;
UINT16 uiPicType;
PBYTE pBuff;
LONG32 lRet = RES_SUCCESS; nPicSize = ImageSize(ulObjHandle);
uiPicType = ImageType(ulObjHandle);
nHeaderSize = ImageHeaderSize(ulObjHandle);
TRACE2("OnImageReady: %d\t0x%08x.\n", lCam, nPicSize); m_TransferProgress.SetRange32(0, nPicSize);
pBuff = new BYTE[nPicSize];
#ifdef _USE_MOCHA_CALLBACKS
lRet = GetImageHeader(lCam, ulObjHandle, pBuff, nHeaderSize);
if (lRet == RES_SUCCESS) {
lRet = GetImage(lCam, ulObjHandle, pBuff, nPicSize, nHeaderSize, ImageTransferProgress, this);
#else
lRet = GetImageHeader(lCam, ulObjHandle, pBuff, nHeaderSize);
if (lRet == RES_SUCCESS) {
lRet = GetImage(lCam, ulObjHandle, pBuff, nPicSize, nHeaderSize);
#endif
if (lRet == RES_SUCCESS) {
CString strFileName(*__argv); // get the command line 
int i = strFileName.ReverseFind(_T('\\')); // strip off the executable name to get the path
if (i >= 0) 
strFileName = strFileName.Left(i + 1);
else 
strFileName = _T("");
switch (uiPicType) {
case OBJ_FORMAT_TIFF:
strFileName += _T("picture.tif");
break;
case OBJ_FORMAT_RAW:
strFileName += _T("picture.orf");
break;
case OBJ_FORMAT_EXIF:
default:
strFileName += _T("picture.jpg");
}
CFile f(strFileName, CFile::modeCreate | CFile::modeWrite);
f.Write(pBuff, nPicSize);
f.Close();
}
} delete [] pBuff; return lRet;
}
#endif
这段程序只能拍一张,再拍就把原来的覆盖了,怎么才能让他多拍几张呢??