⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 camsettingdlg.cpp

📁 WinCE下实现的罗技usb摄像头驱动程序 镜像启动後插入摄像头并输入驱动dll名称进行加载 附带测试程序
💻 CPP
字号:
// CamSettingDlg.cpp : implementation file
//

#include "stdafx.h"
#include "LGCAMCECTRL.h"
#include "CamSettingDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CCamSettingDlg dialog


CCamSettingDlg::CCamSettingDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCamSettingDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCamSettingDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCamSettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCamSettingDlg)
	DDX_Control(pDX, IDC_SETTINGSLIST, m_Settingslist);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCamSettingDlg, CDialog)
	//{{AFX_MSG_MAP(CCamSettingDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCamSettingDlg message handlers

BOOL CCamSettingDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	int i, rc;	
	DWORD dwSize;
	static PFEATUREPROPS pProps;

	rc = GetFeatureList (NULL, &dwSize);
	if (rc)
	{
		printf ("Error getting feature list size rc %d\r\n", rc);
		return TRUE;
	}
	// Allocate the buffer
	pProps = (PFEATUREPROPS) LocalAlloc (LPTR, dwSize);

	rc = GetFeatureList (pProps, &dwSize);
	
	for (i = 0; i < pProps->nNumProps; i++)
	{
		m_Settingslist.AddString(GetFeatureText (pProps->fpArray[i].dwFeatureID));
	}

	SendDlgItemMessage (IDC_SETTINGSLIST, LB_SETCURSEL, 0, 0);
	SetControlVals (pProps);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

//////////////////////////////////////////////////////////////////////////////////////////
int CCamSettingDlg::SetControlVals (PFEATUREPROPS pProps)
{
	int index, rc;
	TCHAR sz[256];
	DWORD dwVal;

	index = SendDlgItemMessage (IDC_SETTINGSLIST, LB_GETCURSEL, 0, 0);
	if (index < pProps->nNumProps)
	{
		if (pProps->fpArray[index].dwFlags & FLAG_FP_ERROR)
		{
			wsprintf (sz, TEXT("Error\r\n%d"), pProps->fpArray[index].nMin);
			SetDlgItemText (IDC_MINTEXT, sz);
			SetDlgItemText (IDC_MAXTEXT, sz);
		}
		else
		{
			wsprintf (sz, TEXT("Minimum\r\n%d"), pProps->fpArray[index].nMin);
			SetDlgItemText (IDC_MINTEXT, sz);
			wsprintf (sz, TEXT("Maximum\r\n%d"), pProps->fpArray[index].nMax);
			SetDlgItemText (IDC_MAXTEXT, sz);
		}
		// Set slider limits
		SendDlgItemMessage (IDC_PROPSETTING, TBM_SETRANGEMIN, 
							0, pProps->fpArray[index].nMin);

		SendDlgItemMessage (IDC_PROPSETTING, TBM_SETRANGEMAX, 
							TRUE, pProps->fpArray[index].nMax);

		// Compute the spread and set tick frequency
		int nTick = pProps->fpArray[index].nMax - pProps->fpArray[index].nMin;
		if (nTick > 2048) 
			nTick = 256;
		else if (nTick > 256)
			nTick = 16;
		else if (nTick > 16)
			nTick = 4;
		else 
			nTick = 1;
		SendDlgItemMessage (IDC_PROPSETTING, TBM_SETTICFREQ, nTick, 0);

		// Get the current value
		rc = GetFeatureSetting (pProps->fpArray[index].dwFeatureID, &dwVal);
		if (rc == 0)
		{
			wsprintf (sz, TEXT("Currently\r\n%d"), dwVal);
			SetDlgItemText (IDC_CURTEXT, sz);

			// Set slider position
			SendDlgItemMessage (IDC_PROPSETTING, TBM_SETPOS, 
								TRUE, dwVal);
		}
		else
		{
			wsprintf (sz, TEXT("Err\r\n%d"), rc);
			SetDlgItemText (IDC_CURTEXT, sz);
		}
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -