亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? editfilters.cpp

?? 一個完整的OPC CLIENT 定制接口源程序
?? CPP
字號:
// **************************************************************************
// editfilters.cpp
//
// Description:
//	Implements several special purpose edit box classes.
//
// DISCLAIMER:
//	This programming example is provided "AS IS".  As such Kepware, Inc.
//	makes no claims to the worthiness of the code and does not warranty
//	the code to be error free.  It is provided freely and can be used in
//	your own projects.  If you do find this code useful, place a little
//	marketing plug for Kepware in your code.  While we would love to help
//	every one who is trying to write a great OPC client application, the 
//	uniqueness of every project and the limited number of hours in a day 
//	simply prevents us from doing so.  If you really find yourself in a
//	bind, please contact Kepware's technical support.  We will not be able
//	to assist you with server related problems unless you are using KepServer
//	or KepServerEx.
// **************************************************************************


#include "stdafx.h"
#include "ctype.h"
#include "editfilters.h"

// Macro returns TRUE if virtual key code is < VK_SPACE (0x20).  This includes
// VK_LBUTTON, VK_CANCEL, VK_BACK, VK_TAB, VK_CLEAR, VK_RETURN, VK_SHIFT,
// VK_CONTROL, VK_MENU, VK_CAPITAL, and VK_ESCAPE.
#define mIsSystemKey(k)	(k < VK_SPACE)


/////////////////////////////////////////////////////////////////////////////
// Base edit control filter - handles WM_CHAR and WM_PASTE
/////////////////////////////////////////////////////////////////////////////

// **************************************************************************
BEGIN_MESSAGE_MAP (CEditBase, CEdit)
	ON_WM_CHAR ()
	ON_MESSAGE (WM_PASTE, OnPaste)
END_MESSAGE_MAP ()


// **************************************************************************
// OnChar ()
//
// Description:
//	Override for CWnd::OnChar that allows us to process the character and 
//	beep if there is a problem.
//
// Parameters:
//	UINT		nChar		Contains the character code value of the key. 
//	UINT		nRepCnt		Contains the repeat count.
//	UINT		nFlags		Flags.
//
// Returns:
//  void
// **************************************************************************
void CEditBase::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
	{
	// If key is a system key, as defined by abovve macro, or one of the
	// characters accpted by derived class ProcessChar(), then accept the
	// character by calling default processor and returning.
	if (mIsSystemKey (nChar) || ProcessChar (nChar))
		{
		// Default processing:
		CEdit::OnChar (nChar, nRepCnt, nFlags);
		
		// If this was not a system key, then it was an acceptable character.
		// Clear empty indicator now that a valid char has been recieved:
		if (!mIsSystemKey (nChar))
			m_bEmpty = false;

		// Return now to prevent beep:
		return;
		}

	// If we make it here, then we don't like the character entered.
	// Sound a beep to let user user know.
	MessageBeep (-1);
	}

// **************************************************************************
// OnPaste ()
//
// Description:
//	Allows us to process each character in a paste operation.
//
// Parameters:
//  none
//
// Returns:
//  void
// **************************************************************************
long CEditBase::OnPaste (WPARAM /*wNotUsed*/, LPARAM /*lNotUsed*/)
	{
	// Define string format used by build type (UNICODE or ANSI):
#ifdef _UNICODE
	UINT uFmt = CF_UNICODETEXT;
#else
	UINT uFmt = CF_TEXT;
#endif

	// See if we can get text from clipboard.  If we can't, then sound a beep
	// to let user know there was a problem and return:
	if (!IsClipboardFormatAvailable (uFmt))
		{
		MessageBeep (-1);
		return (0);
		}

	// If we fail to open the clipboard, return:
	if (!OpenClipboard ())
		return (0);

	// If we make it here, clipboard content looks OK and we were able
	// to open it.  Make a local copy of the text in the clipboard.

	// First need to get the handle to clipboard data:
	HANDLE hText = GetClipboardData (uFmt);

	// Next lock the clipboard to prevent any other thread from 
	// overwritting the data while we are copying it.  Copy the
	// data to our local container (strCopy):
	CString strCopy ((LPCTSTR)GlobalLock (hText));

	// Now we are done with the clipboard, so unlock and close:
	GlobalUnlock (hText);
	CloseClipboard ();

	// Validate each char and if OK let the default processing handle
	// the paste.  Get pointer to first character:
	LPCTSTR lpText = strCopy;
	
	// Loop over characters until we hit the NULL terminator:
	do
		{
		// Let derived class ProcessChar() function check the character.
		// If it doesn't like it, sound a beep and return.
		if (!ProcessChar (*lpText))
			{
			MessageBeep (-1);
			return (0);
			}
		}
	while (*++lpText);

	// If we make it here, then all of the characters look OK.  Perform
	// default processing to do the actual paste to control:
	return (Default ());
	}


/////////////////////////////////////////////////////////////////////////////
// Name name edit control filter
/////////////////////////////////////////////////////////////////////////////

// **************************************************************************
// ProcessChar ()
//
// Description:
//	Name edit control char filter.
//
// Parameters:
//	UINT		nChar		Character code.
//
// Returns:
//  BOOL - FALSE if character is invalid.
// **************************************************************************
BOOL CNameEdit::ProcessChar (UINT nChar)
	{
	// Valid characters are alpha numerics and underscore:
	return (_istalnum (nChar) || nChar == '_');
	}


/////////////////////////////////////////////////////////////////////////////
// Numeric name edit control filter
/////////////////////////////////////////////////////////////////////////////

// **************************************************************************
BEGIN_MESSAGE_MAP (CNumericEdit, CEditBase)
	ON_MESSAGE (WM_GETTEXT, OnGetText)
	ON_MESSAGE (WM_SETTEXT, OnSetText)
END_MESSAGE_MAP ()


// **************************************************************************
// ProcessChar ()
//
// Description:
//	Numeric edit control char filter.
//
// Parameters:
//	UINT		nChar		Character code.
//
// Returns:
//  BOOL - FALSE if character is invalid.
// **************************************************************************
BOOL CNumericEdit::ProcessChar (UINT nChar)
	{
	// Valid characters for unsigned decimal format are all digits:
	if (m_eFormat == tUnsignedDecimal)
		return (_istdigit (nChar));

	// Valid characters for signed decimal format are all digits and
	// minus sign:
	if (m_eFormat == tSignedDecimal)
		return (_istdigit (nChar) || nChar == _T('-'));

	// Valid characters for octal format are digits between 0 and 7
	// inclusive:
	if (m_eFormat == tOctal)
		return (nChar >= _T('0') && nChar <= _T('7'));

	// Valid characters for hex format are all hex digits:
	if (m_eFormat == tHex)
		return (_istxdigit (nChar));

	// If we make it here, then format is invalid (programmer error).
	ASSERT (FALSE);
	return (false);
	}

// **************************************************************************
// OnGetText ()
//
// Description:
//	Get text of numeric edit control.
//
// Parameters:
//	WPARAM		wParam		Number of characters to get.
//	LPARAM		lParam		Pointer to output string buffer.
//
// Returns:
//  LRESULT - String length if internal processing (m_bInternal == true).
// **************************************************************************
LRESULT CNumericEdit::OnGetText (WPARAM wParam, LPARAM lParam)
	{
	// Always return the text in decimal format (unless this is the initial call)
	if (!m_bInternal && !m_bEmpty)
		{
		// Format the string in decimal format:
		TCHAR szBuff [32];
		_stprintf (szBuff, _T("%u"), GetValue ());

		// Copy the string to lParam:
		lstrcpyn ((LPTSTR)lParam, szBuff, wParam);

		// Return string length:
		return (lstrlen ((LPCTSTR)lParam));
		}

	// If we make it here, then this is an internal call.  If so, do
	// default processing:
	return (Default ());
	}

// **************************************************************************
// OnSetText ()
//
// Description:
//	Set text of numeric edit control.
//
// Parameters:
//  LPARAM		lParam		Pointer to input string buffer.
//
// Returns:
//  LRESULT - true if success if internal processing (m_bInternal == true).
// **************************************************************************
LRESULT CNumericEdit::OnSetText (WPARAM /*wParam*/, LPARAM lParam)
	{
	// Set the value (unless this is an internal call):
	if (!m_bInternal)
		{
		// We will assume text is formatted in decimal:
		SetValue (_ttol ((LPCTSTR)lParam));

		// Return true to indicate success:
		return (true);
		}

	// Control is no longer empty
	m_bEmpty = false;

	// If we make it here, then this is an internal call.  If so, do
	// default processing:
	return (Default ());
	}

// **************************************************************************
// SetValue ()
//
// Description:
//	Set value of nummeric edit control.
//
// Parameters:
//  DWORD		dwVal		Value to set.
//
// Returns:
//  void
// **************************************************************************
void CNumericEdit::SetValue (DWORD dwVal)
	{
	TCHAR szBuf [32];
	TCHAR szOldText [32];

	// Convert value to string.  Format as defined by m_eFormat:
	switch (m_eFormat)
		{
		case tSignedDecimal:
			_stprintf (szBuf, _T("%d"), dwVal);
			break;

		case tUnsignedDecimal:
			_stprintf (szBuf, _T("%u"), dwVal);
			break;

		case tOctal:
			_stprintf (szBuf, _T("%o"), dwVal);
			break;

		case tHex:
			_stprintf (szBuf, _T("%X"), dwVal);
			break;

		default:
			// Invalid format.  Programmer error.  Create NULL string:
			ASSERT (FALSE);
			szBuf [0] = 0;
			break;
		}

	// Place the string we just created in the window.

	// First set the internal flag so we can get text without translation:
	m_bInternal = true;
	
	// Get the current text:
	GetWindowText (szOldText, _countof (szOldText));

	// If the new text is different, then update the control:
	if (lstrcmp (szOldText, szBuf))
		SetWindowText (szBuf);

	// Clear the internal flag:
	m_bInternal = false;
	}

// **************************************************************************
// GetValue ()
//
// Description:
//	Get value of numeric edit control.
//
// Parameters:
//  none
//
// Returns:
//  DWORD - Current value.
// **************************************************************************
DWORD CNumericEdit::GetValue ()
	{
	CString str;

	// Get the current window text.

	// First set the internal flag so we can get text without translation:
	m_bInternal = true;

	// Get the text:
	GetWindowText (str);
	
	// Clear the internal flag:
	m_bInternal = false;

	// Initialize the output value.  This will be the value returned
	// in case of bad format:
	DWORD dwVal = 0;

	// Set output value.  Interpret text according to format specified
	// by m_eFormat:
	switch (m_eFormat)
		{
		case tSignedDecimal:
		case tUnsignedDecimal:
			dwVal = _ttol (str);
			break;

		case tOctal:
			_stscanf (str, _T("%o"), &dwVal);
			break;

		case tHex:
			_stscanf (str, _T("%X"), &dwVal);
			break;

		default:
			// Unexpected format type.  Programmer error.
			ASSERT (FALSE);
			break;
		}

	// Return the value:
	return (dwVal);
	}

// **************************************************************************
// SetFormat ()
//
// Description:
//	Set format of numeric edit control.
//
// Parameters:
//  INTEGERFORMAT	eFormat		Format (tSignedDecimal, tUnsignedDecimal,
//								  tOctal, tHex).
//
// Returns:
//  void
// **************************************************************************
void CNumericEdit::SetFormat (INTEGERFORMAT eFormat)
	{
	// If format hasn't changed, don't need to do anything:
	if (m_eFormat == eFormat)
		return;

	// If we make it here, the format has changed.  We therefore need to
	// reformat the text currently displyed.

	// Get the current value (using old format):
	DWORD dwVal = GetValue ();

	// Reset the format:
	m_eFormat = eFormat;

	// Reset the value displayed (using new format):
	SetValue (dwVal);
	}


/////////////////////////////////////////////////////////////////////////////
// Real number edit control filter
/////////////////////////////////////////////////////////////////////////////

// **************************************************************************
// ProcessChar ()
//
// Description:
//	Numeric edit control char filter.
//
// Parameters:
//	UINT		nChar		Character code.
//
// Returns:
//  BOOL - TRUE if character is valid.
// **************************************************************************
BOOL CRealNumEdit::ProcessChar (UINT nChar)
	{
	// Valid characters are all digits, decimal point, exponent E or e,
	// and minus sign:
	return (_istdigit (nChar) || nChar == _T('.') || nChar == _T('E') || nChar == _T('e') || nChar == _T('-'));
	}


/////////////////////////////////////////////////////////////////////////////
// File name edit control filter
/////////////////////////////////////////////////////////////////////////////

// Valid but unusual file characters:
LPCTSTR CFileNameEdit::sm_szFileChars = _T(" _!#$%^()'&@}{~-");

// **************************************************************************
// ProcessChar ()
//
// Description:
//	File name edit control char filter.
//
// Parameters:
//	UINT		nChar		Character code.
//
// Returns:
//  BOOL - TRUE if character is valid.
// **************************************************************************
BOOL CFileNameEdit::ProcessChar (UINT nChar)
	{
	// Valid characters are alphanumerics and other unusual file name 
	// characters defined above:
	return (_istalnum (nChar) || _tcschr (sm_szFileChars, nChar));
	}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精选午夜久久久乱码6080| 国产宾馆实践打屁股91| 国产一区二区三区综合| 色综合久久六月婷婷中文字幕| 5月丁香婷婷综合| 久久久精品欧美丰满| 亚洲香肠在线观看| 99在线精品观看| 色综合中文字幕| 亚洲美女免费视频| 久久99热这里只有精品| 一本大道综合伊人精品热热| 久久一区二区三区国产精品| 亚洲欧美日韩电影| 国内精品久久久久影院薰衣草| 日本韩国欧美三级| 国产精品区一区二区三区| 一区二区成人在线| 不卡视频免费播放| 精品三级在线观看| 日韩有码一区二区三区| 色丁香久综合在线久综合在线观看| 久久精品夜色噜噜亚洲a∨| 亚洲成人动漫一区| 91色视频在线| 亚洲人成亚洲人成在线观看图片| 国内外精品视频| 日韩一级完整毛片| 捆绑变态av一区二区三区 | 久久www免费人成看片高清| 欧美日韩小视频| 亚洲成人第一页| 欧美日韩精品综合在线| 三级影片在线观看欧美日韩一区二区| 色老头久久综合| 亚洲国产日韩综合久久精品| 91精品1区2区| 午夜不卡在线视频| 欧美精品tushy高清| 秋霞电影一区二区| 欧美v亚洲v综合ⅴ国产v| 久久草av在线| 欧美国产一区视频在线观看| 懂色av一区二区在线播放| 国产精品理论片在线观看| av在线免费不卡| 亚洲在线一区二区三区| 欧美日韩精品系列| 久久国产精品一区二区| 久久天天做天天爱综合色| 国产91丝袜在线播放0| 中文字幕一区二区三区不卡在线| 成人综合在线观看| 一区二区三区美女| 91精品国产手机| 国产伦精品一区二区三区免费| 国产性色一区二区| 色综合激情五月| 麻豆精品在线观看| 日本一区二区不卡视频| 在线亚洲一区观看| 久久爱另类一区二区小说| 综合分类小说区另类春色亚洲小说欧美 | 日韩va亚洲va欧美va久久| 精品久久久久久久一区二区蜜臀| 国产精品一二一区| 一区二区三区四区国产精品| 欧美一区二区三区公司| 成人高清免费在线播放| 日韩精品午夜视频| 中文字幕精品一区| 欧美精品三级日韩久久| 国产精品123| 天天综合天天做天天综合| 久久久久久久久久久久久夜| 91在线你懂得| 免费看精品久久片| 玉足女爽爽91| 中文字幕乱码久久午夜不卡| 欧美精品18+| 99久久国产综合精品女不卡| 天堂在线一区二区| 亚洲色图第一区| 国产日韩欧美综合一区| 在线不卡中文字幕| 91浏览器打开| 国产99久久久国产精品潘金网站| 五月天久久比比资源色| 综合久久综合久久| 国产日韩欧美a| 欧美日本一道本在线视频| 国产经典欧美精品| 另类小说视频一区二区| 一区二区三区四区在线播放| 中文字幕av一区二区三区免费看| 欧美一区二区精品久久911| 99精品欧美一区二区蜜桃免费| 一区二区三区精品| 国产欧美日韩亚州综合| 精品成人在线观看| 日韩欧美你懂的| 欧美美女一区二区在线观看| 欧洲人成人精品| 日本成人在线不卡视频| 亚洲午夜在线视频| 亚洲成人免费观看| 洋洋av久久久久久久一区| 国产精品家庭影院| 中文字幕在线免费不卡| 中文字幕乱码亚洲精品一区| 国产校园另类小说区| 欧美zozo另类异族| 欧美一级黄色录像| 日韩欧美中文字幕一区| 欧美一区二区久久| 精品蜜桃在线看| 26uuu久久天堂性欧美| 久久蜜桃av一区精品变态类天堂 | 欧美一区二区三区系列电影| 欧美群妇大交群中文字幕| 精品视频在线看| 欧美日韩国产经典色站一区二区三区| 欧美视频自拍偷拍| 欧美日韩不卡一区| 日韩欧美在线123| 久久久久综合网| 国产精品人成在线观看免费 | 中文字幕av一区二区三区免费看| 国产精品私房写真福利视频| 中文字幕一区二区三区在线不卡 | 欧美极品美女视频| 1000精品久久久久久久久| 一区二区三区在线看| 亚洲1区2区3区4区| 久久精品久久综合| 国产九色精品成人porny | 国产一区二区h| 成人美女在线观看| 色天天综合久久久久综合片| 欧美午夜在线一二页| 日韩一区二区三区三四区视频在线观看| 欧美一区二区成人| 国产免费观看久久| 一区二区三区高清不卡| 青草av.久久免费一区| 成人免费精品视频| 欧美日韩黄色一区二区| 久久美女高清视频| 亚洲一二三四区| 狠狠色综合播放一区二区| 一本久久精品一区二区| 欧美精品日韩精品| 欧美激情一区二区三区蜜桃视频 | 精品久久五月天| 亚洲丝袜自拍清纯另类| 日本欧美一区二区| av激情成人网| 精品日韩一区二区三区免费视频| 国产精品美女久久久久久久久 | 国产老妇另类xxxxx| 欧美在线一区二区三区| 久久蜜桃香蕉精品一区二区三区| 综合激情网...| 国内不卡的二区三区中文字幕| www.66久久| 26uuu国产电影一区二区| 亚洲综合成人网| 国产福利电影一区二区三区| 欧美嫩在线观看| 亚洲色图制服丝袜| 韩国精品主播一区二区在线观看 | 日韩精品亚洲一区二区三区免费| 成人激情av网| 欧美电影免费观看完整版 | 亚洲欧美综合另类在线卡通| 美女网站视频久久| 欧美日韩免费在线视频| 国产精品卡一卡二| 国产一区欧美一区| 日韩一区二区视频| 天堂影院一区二区| 欧美丝袜丝nylons| 亚洲欧美色综合| 波多野结衣在线一区| 久久久久久97三级| 韩国精品主播一区二区在线观看 | 国产精品欧美极品| 国产精品一区二区视频| 精品国产一区二区精华| 日韩电影在线看| 911精品国产一区二区在线| 一区二区三区免费在线观看| jizzjizzjizz欧美| 中文字幕一区二区三区色视频| 国产激情一区二区三区| 久久综合久久综合亚洲| 国内精品伊人久久久久av一坑| 亚洲精品一区二区三区影院| 九九**精品视频免费播放| 精品国产三级电影在线观看|