📄 phonecameratestdlg.cpp
字号:
// PhoneCameraTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "PhoneCameraTest.h"
#include "PhoneCameraTestDlg.h"
#include <aygshell.h>
#include "macros.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CPhoneCameraTestDlg dialog
CPhoneCameraTestDlg::CPhoneCameraTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPhoneCameraTestDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CPhoneCameraTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CPhoneCameraTestDlg, CDialog)
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
ON_WM_SIZE()
#endif
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON1, &CPhoneCameraTestDlg::OnBnClickedButton1)
END_MESSAGE_MAP()
// CPhoneCameraTestDlg message handlers
BOOL CPhoneCameraTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
void CPhoneCameraTestDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
{
DRA::RelayoutDialog(
AfxGetInstanceHandle(),
this->m_hWnd,
DRA::GetDisplayMode() != DRA::Portrait ?
MAKEINTRESOURCE(IDD_PHONECAMERATEST_DIALOG_WIDE) :
MAKEINTRESOURCE(IDD_PHONECAMERATEST_DIALOG));
}
#endif
#define CECAMERA_DEFAULT_STILL_QUALITY CAMERACAPTURE_STILLQUALITY_DEFAULT
#define CECAMERA_DEFAULT_MODE CAMERACAPTURE_MODE_STILL
#define CECAMERA_DEFAULT_VIDEO_TYPES CAMERACAPTURE_VIDEOTYPE_ALL
#define MAX_MESSAGE MAX_PATH * 2
void CPhoneCameraTestDlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
HWND hwndDlg;
CAMERACAPTURE_STILLQUALITY g_StillQuality = CECAMERA_DEFAULT_STILL_QUALITY;
CAMERACAPTURE_VIDEOTYPES g_VideoTypes = CECAMERA_DEFAULT_VIDEO_TYPES;
CAMERACAPTURE_MODE g_Mode = CECAMERA_DEFAULT_MODE;
SHCAMERACAPTURE shcc;
HRESULT hReturn;
LPCTSTR szFormat;
HINSTANCE g_hInstance = NULL;
TCHAR szMessage[MAX_MESSAGE] = { 0 };
TCHAR PicturePath[MAX_PATH];
HRESULT hr;
LPCTSTR g_szCaption;
ZeroMemory(&shcc, sizeof(shcc));
shcc.cbSize = sizeof(shcc);
shcc.hwndOwner = hwndDlg;
shcc.pszInitialDir = 0;
shcc.pszDefaultFileName = 0;
shcc.pszTitle = 0;
shcc.StillQuality =g_StillQuality;
shcc.VideoTypes =g_VideoTypes;
shcc.nResolutionWidth = 0;
shcc.nResolutionHeight = 0;
shcc.nVideoTimeLimit = 0;
shcc.Mode = g_Mode;
hReturn = SHCameraCapture(&shcc);
memcpy( PicturePath , shcc.szFile , sizeof(PicturePath) );
MessageBox(PicturePath);
// switch (hReturn)
// {
// case S_OK:
// // The method completed successfully.
// szFormat = (LPCTSTR)LoadString(g_hInstance, 405, NULL, 0);
// CPR(szFormat);
// CHR(StringCchPrintf(szMessage, ARRAYSIZE(szMessage), szFormat, shcc.szFile));
// //MessageBox(hwndDlg, szMessage, g_szCaption, MB_OK | MB_ICONINFORMATION);
// MessageBox(shcc.szFile);
// break;
// }
//
//Error:
// return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -