📄 stillcapdlg.cpp
字号:
// StillCapDlg.cpp : implementation file
//
#include "stdafx.h"
#include "LGCAMCECTRL.h"
#include "StillCapDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// 摄像头支持的静态图片格式
FORMATPROPS StillFormats[MAXSTILLFORMATS];
int nStillFmtCnt = MAXSTILLFORMATS;
/////////////////////////////////////////////////////////////////////////////
// CStillCapDlg dialog
CStillCapDlg::CStillCapDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStillCapDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStillCapDlg)
m_strFileName = _T("");
//}}AFX_DATA_INIT
}
void CStillCapDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStillCapDlg)
DDX_Control(pDX, IDC_FORMATLIST, m_formatlist);
DDX_Text(pDX, IDC_FILENAME, m_strFileName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStillCapDlg, CDialog)
//{{AFX_MSG_MAP(CStillCapDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStillCapDlg message handlers
BOOL CStillCapDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int i, rc;
static PSTILLCAPDLGSTRUCT pStillCap;
TCHAR szStillFileName[MAX_PATH] = TEXT("sample.jpg");
DWORD dw1[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
DWORD dw2[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
DWORD dw3[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
memset (&scStruct, 0, sizeof (scStruct));
// Get the list of still formats supported
rc = GetStillFormats (StillFormats, &nStillFmtCnt);
// Fill the list box with the supported formats
CString str;
for (i = 0; i < nStillFmtCnt; i++)
{
str.Format(L"%d x %d",StillFormats[i].dwWidth, StillFormats[i].dwHeight);
m_formatlist.AddString(str);
}
m_strFileName = L"test.jpg";
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStillCapDlg::OnOK()
{
// TODO: Add extra validation here
// 获取格式信息
int i = m_formatlist.GetCurSel();
if ((i >= 0) && (i < nStillFmtCnt))
{
scStruct.wFormat = StillFormats[i].wFormatIndex;
scStruct.wFrame = StillFormats[i].wFrameIndex;
}
UpdateData(TRUE);
wcscpy(scStruct.szFileName,m_strFileName);
CDialog::OnOK();
}
void CStillCapDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -