- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
void CVC6_SampleCodeDlg::OnButtonSaveframe()
{
// TODO: Add your control notification handler code here
SYSTEMTIME lpSysTime;
GetLocalTime(&lpSysTime);
long Dims = SafeArrayGetDim(pvBuffer.parray);
if(Dims != 1)
return;
char *pbuf = (char*)malloc(m_FrameSize);
char *pfinal = pbuf;
for(long i=0;i<m_FrameSize;i++)
{
SafeArrayGetElement(pvBuffer.parray, &i, pfinal++);
}
FILE* fSaveFile;
CString saveName;
if(m_vportsdk.GetGetStreamType() == 1)
saveName.Format(".//%d%d%d_%d%d%d.mpg4",lpSysTime.wYear, lpSysTime.wMonth, lpSysTime.wDay,
lpSysTime.wHour, lpSysTime.wMinute, lpSysTime.wSecond);
else if(m_vportsdk.GetGetStreamType() == 2)
saveName.Format(".//%d%d%d_%d%d%d.jpg",lpSysTime.wYear, lpSysTime.wMonth, lpSysTime.wDay,
lpSysTime.wHour, lpSysTime.wMinute, lpSysTime.wSecond);
if((fSaveFile = fopen((LPCTSTR)saveName,"wb"))!=NULL)
{
fwrite(pbuf, 1, m_FrameSize, fSaveFile);
fclose(fSaveFile);
}
SafeArrayUnaccessData(pvBuffer.parray);
delete pbuf;
pbuf = NULL;
}