PropertySheet1.cpp
上传用户:yongqian
上传日期:2007-01-02
资源大小:74k
文件大小:2k
源码类别:
PropertySheet
开发平台:
Visual C++
- // PropertySheet1.cpp : implementation file
- //
- #include "stdafx.h"
- #include "propinprop.h"
- #include "PropertySheet1.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // PropertySheet1
- IMPLEMENT_DYNAMIC(PropertySheet1, CPropertySheet)
- PropertySheet1::PropertySheet1()
- {
- }
- PropertySheet1::~PropertySheet1()
- {
- }
- BOOL PropertySheet1::CheckKey(char cAccel)
- {
- CTabCtrl *pTab = GetTabControl();
- int n = pTab->GetItemCount();
- char buf[80], shortcut[3];
- TC_ITEM tcItem;
- tcItem.mask = TCIF_TEXT;
- tcItem.pszText = buf;
- shortcut[0] = _T('&');
- shortcut[2] = _T(' ');
- for( int i = 0; i < n; i++ ) {
- tcItem.cchTextMax = 79;
- pTab->GetItem( i, &tcItem );
- shortcut[1] = cAccel;
- // convert string characters into uppercase characters
- short nCount = 0;
- while( buf[nCount] != ' ' ) {
- buf[nCount] = toupper(buf[nCount]);
- ++nCount;
- }
- if( strstr( buf, shortcut ) ) {
- SetActivePage( i );
- return TRUE;
- }
- }
- return FALSE;
- }
- BOOL PropertySheet1::PreTranslateMessage(MSG* pMsg)
- {
- if( pMsg->message == WM_SYSKEYDOWN && pMsg->wParam > 32 )
- {
- if(CheckKey(pMsg->wParam))
- return TRUE;
- return(GetParent()->GetParent()->PreTranslateMessage(pMsg));
- }
- return CPropertySheet::PreTranslateMessage(pMsg);
- }
- BEGIN_MESSAGE_MAP(PropertySheet1, CPropertySheet)
- //{{AFX_MSG_MAP(PropertySheet1)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // PropertySheet1 message handlers