📄 deviceinfodlg.cpp
字号:
/*
Filename : DeviceInfoDlg.cpp
Part of : Phone Navigator
Description : Implementation of device info dialog class
Version : 3.2
This example is only to be used with PC Connectivity API version 3.2.
Compability ("as is") with future versions is not quaranteed.
Copyright (c) 2007 Nokia Corporation.
This material, including but not limited to documentation and any related
computer programs, is protected by intellectual property rights of Nokia
Corporation and/or its licensors.
All rights are reserved. Reproducing, modifying, translating, or
distributing any or all of this material requires the prior written consent
of Nokia Corporation. Nokia Corporation retains the right to make changes
to this material at any time without notice. A copyright license is hereby
granted to download and print a copy of this material for personal use only.
No other license to any other intellectual property rights is granted. The
material is provided "as is" without warranty of any kind, either express or
implied, including without limitation, any warranty of non-infringement,
merchantability and fitness for a particular purpose. In no event shall
Nokia Corporation be liable for any direct, indirect, special, incidental,
or consequential loss or damages, including but not limited to, lost profits
or revenue,loss of use, cost of substitute program, or loss of data or
equipment arising out of the use or inability to use the material, even if
Nokia Corporation has been advised of the likelihood of such damages occurring.
*/
#include "stdafx.h"
#include "PhoneNavigator.h"
#include "DeviceInfoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//===================================================================
// CDeviceInfoDlg
//===================================================================
// Constructor
//
//===================================================================
CDeviceInfoDlg::CDeviceInfoDlg(CONAPI_DEVICE_GEN_INFO* pInfo,
CWnd* pParent /*=NULL*/)
: CDialog(CDeviceInfoDlg::IDD, pParent), m_pInfo(pInfo)
{
}
BEGIN_MESSAGE_MAP(CDeviceInfoDlg, CDialog)
//{{AFX_MSG_MAP(CDeviceInfoDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//===================================================================
// CDeviceInfoDlg message handlers
//===================================================================
// OnInitDialog
//
//===================================================================
BOOL CDeviceInfoDlg::OnInitDialog()
{
// Show file system support
if (m_pInfo->dwFileSystemSupport == CONAPI_FS_NOT_SUPPORTED)
{
AddStaticText(IDC_FS_SUPPORTED, L"Device does not support file system");
}
else if (m_pInfo->dwFileSystemSupport & CONAPI_FS_SUPPORTED)
{
AddStaticText(IDC_FS_SUPPORTED, L"Device supports file system");
}
EnableStatic(IDC_FS_JAVA_SUPPORTED, m_pInfo->dwFileSystemSupport & CONAPI_FS_INSTALL_JAVA_APPLICATIONS);
EnableStatic(IDC_FS_SIS_SUPPORTED, m_pInfo->dwFileSystemSupport & CONAPI_FS_INSTALL_SIS_APPLICATIONS);
EnableStatic(IDC_FS_FILE_CONVERSION, m_pInfo->dwFileSystemSupport & CONAPI_FS_FILE_CONVERSION);
// Show syncronization support
if (m_pInfo->dwSyncSupport == CONAPI_SYNC_NOT_SUPPORTED)
{
AddStaticText(IDC_SYNC_SUPPORTED, L"Device does not support syncronization");
}
else
{
AddStaticText(IDC_SYNC_SUPPORTED, L"Device supports syncronization");
}
EnableStatic(IDC_SYNC_SA_DS, m_pInfo->dwSyncSupport & CONAPI_SYNC_SA_DS);
EnableStatic(IDC_SYNC_SA_DM, m_pInfo->dwSyncSupport & CONAPI_SYNC_SA_DM);
EnableStatic(IDC_SYNC_CI_DS, m_pInfo->dwSyncSupport & CONAPI_SYNC_CI_DS);
// Show device type
EnableStatic(IDC_S40_DEVICE, m_pInfo->dwType == CONAPI_SERIES40_DEVICE);
EnableStatic(IDC_S60_2ED_DEVICE, m_pInfo->dwType == CONAPI_SERIES60_2ED_DEVICE);
EnableStatic(IDC_S60_3RD_DEVICE, m_pInfo->dwType == CONAPI_SERIES60_3ED_DEVICE);
EnableStatic(IDC_S80_DEVICE, m_pInfo->dwType == CONAPI_SERIES80_DEVICE);
EnableStatic(IDC_UNKNOWN_DEVICE, m_pInfo->dwType == CONAPI_UNKNOWN_DEVICE);
// Show general info:
// - device type name
// - software version
// - used language
AddStaticText(IDC_TYPE_NAME, m_pInfo->pstrTypeName);
AddStaticText(IDC_SW_VERSION, m_pInfo->pstrSWVersion);
AddStaticText(IDC_LANGUAGE, m_pInfo->pstrUsedLanguage);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//===================================================================
// EnableStatic
//
// Enables/disables the given static item on the dialog.
//===================================================================
void CDeviceInfoDlg::EnableStatic(int nID, BOOL bEnable)
{
CStatic* pStatic = (CStatic*)GetDlgItem(nID);
if (pStatic != NULL)
{
pStatic->EnableWindow(bEnable);
}
}
//===================================================================
// AddStaticText
//
// Whether passed text is not NULL, appends it to the static text and
// enables the item. Otherwise item gets disabled.
//===================================================================
void CDeviceInfoDlg::AddStaticText(int nID, LPCTSTR lpszTxt)
{
EnableStatic(nID, lpszTxt != NULL);
if (lpszTxt != NULL)
{
// Get static and its current text
CString strTxt = "";
TCHAR szWndTxt[MAX_PATH] = {0};
CStatic* pStatic = (CStatic*)GetDlgItem(nID);
if (pStatic != NULL)
{
pStatic->GetWindowText(szWndTxt, MAX_PATH);
// Append
strTxt += szWndTxt;
strTxt += lpszTxt;
// Apply changes
pStatic->SetWindowText(strTxt);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -