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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? editfilters.cpp

?? 這個是我現在在做組態軟件開發用到的OPC源碼
?? 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));
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人av在线播放| 中文字幕一区二区三中文字幕| 欧美一a一片一级一片| 91麻豆产精品久久久久久| 日本韩国视频一区二区| 欧美综合视频在线观看| 欧美一区永久视频免费观看| 日韩欧美一级二级| 国产精品三级电影| 亚洲成人自拍网| 欧美少妇xxx| 91精品国产综合久久福利| 精品久久久久久综合日本欧美| 欧美国产成人在线| 成人性生交大片免费| 色国产精品一区在线观看| 91精品国产综合久久精品性色| 国产日产精品1区| 亚洲无线码一区二区三区| 国产精品中文字幕日韩精品| 欧美中文字幕一区二区三区| 久久亚洲二区三区| 日韩精品国产精品| 在线欧美日韩精品| 国产精品久久午夜| 国产一区二区三区四区五区美女| 91麻豆国产自产在线观看| 久久嫩草精品久久久精品| 日韩国产精品久久久久久亚洲| 91麻豆国产自产在线观看| 日韩国产精品91| 欧美伊人久久久久久午夜久久久久| 中文字幕精品在线不卡| 国产一区二区三区四区五区美女 | 久久99国产精品麻豆| 在线亚洲高清视频| 亚洲欧美成aⅴ人在线观看 | 久久久久久97三级| 精品伊人久久久久7777人| 欧美大片顶级少妇| 国产一区二区视频在线播放| 欧美成人精品福利| 麻豆freexxxx性91精品| 日韩视频免费观看高清完整版在线观看 | 麻豆中文一区二区| 欧美xxxxxxxx| 久久se这里有精品| 精品国产精品一区二区夜夜嗨 | 欧美在线免费视屏| 天堂在线一区二区| 久久综合成人精品亚洲另类欧美 | 国产日韩精品一区二区三区在线| 岛国一区二区三区| 亚洲欧美日韩小说| 91麻豆精品国产91久久久资源速度 | 91在线免费视频观看| 亚洲123区在线观看| 久久久久久97三级| 欧美情侣在线播放| 成人综合婷婷国产精品久久蜜臀 | 欧美一区2区视频在线观看| 粉嫩嫩av羞羞动漫久久久| 亚洲成人动漫在线免费观看| 久久久精品tv| 日韩欧美色综合| 99精品视频在线观看免费| 亚洲成年人影院| 丁香婷婷综合激情五月色| 国产在线麻豆精品观看| 亚洲国产另类av| 一区二区三区视频在线看| 精品国产1区二区| 欧美一区二区视频在线观看| 欧美私模裸体表演在线观看| 99精品热视频| 成人在线综合网| 成人国产精品免费观看视频| 高清在线不卡av| 成人中文字幕电影| 成人午夜在线播放| 成人av资源网站| eeuss影院一区二区三区 | 2020国产精品久久精品美国| 欧美一区二区三区在线看| 91精品国产综合久久小美女| 日韩视频免费观看高清在线视频| 欧美一区二区三区色| 久久影音资源网| 18欧美亚洲精品| 日韩激情一二三区| 国产麻豆欧美日韩一区| 91首页免费视频| 欧美老年两性高潮| 久久日韩精品一区二区五区| 久久蜜桃av一区二区天堂| 亚洲美女视频在线| 美国毛片一区二区三区| 成人午夜免费av| 在线综合视频播放| 中文字幕一区二区三区四区| 亚洲国产综合在线| 国产精品资源网| 欧美精品v国产精品v日韩精品| 26uuu精品一区二区三区四区在线| 一色屋精品亚洲香蕉网站| 蜜桃传媒麻豆第一区在线观看| 精品久久国产字幕高潮| 欧美高清在线一区| 精品一二三四在线| 欧美人体做爰大胆视频| 亚洲天堂av老司机| 国产成人av影院| 欧美电影精品一区二区| 午夜精品久久久久久久99樱桃| 暴力调教一区二区三区| 2021国产精品久久精品| 麻豆国产一区二区| 91精品免费在线观看| 日韩精品一区第一页| 欧日韩精品视频| 亚洲夂夂婷婷色拍ww47| 成人精品gif动图一区| 国产丝袜美腿一区二区三区| 美女一区二区在线观看| 欧美一区二区三区成人| 午夜久久久影院| 91精品久久久久久久久99蜜臂| 午夜精品久久久久久久久久| 一本大道久久a久久综合| 18成人在线观看| 欧美性猛交xxxx黑人交| 亚洲综合色成人| 日韩午夜在线播放| 国产在线不卡视频| 国产精品亲子伦对白| 精品午夜一区二区三区在线观看| 欧美中文字幕久久| 尤物av一区二区| 欧美巨大另类极品videosbest| 免费在线观看一区二区三区| 精品日韩在线观看| 岛国精品一区二区| 日韩av在线免费观看不卡| 2020国产精品| 欧美日韩中字一区| 国内精品久久久久影院一蜜桃| 亚洲女子a中天字幕| 欧美精品一区二区三区高清aⅴ | 亚州成人在线电影| 久久亚洲综合av| 欧洲一区在线电影| av亚洲精华国产精华| 精品一区二区在线播放| 亚洲最新视频在线观看| 国产精品成人在线观看| 日韩欧美色电影| 欧美高清www午色夜在线视频| 99久久免费精品| 国产成人综合亚洲网站| 精品一区二区国语对白| 婷婷成人激情在线网| 亚洲最快最全在线视频| 日韩一区在线播放| 久久久电影一区二区三区| 日韩欧美国产1| 正在播放亚洲一区| 欧美一二三在线| 日韩欧美中文字幕制服| 欧美日韩二区三区| 欧美高清视频一二三区 | 精品无人区卡一卡二卡三乱码免费卡 | 国产成a人亚洲| 成人午夜在线免费| 91视频www| 91国内精品野花午夜精品| 在线观看视频一区| 欧美丰满高潮xxxx喷水动漫| 91麻豆精品国产91久久久久| 日韩欧美国产1| 欧美国产精品中文字幕| 国产精品短视频| 午夜伊人狠狠久久| 激情综合一区二区三区| 成人晚上爱看视频| 51精品久久久久久久蜜臀| 欧美一区二区三区男人的天堂| 亚洲一区二区欧美日韩| 免费欧美日韩国产三级电影| 国产福利不卡视频| 欧美日韩免费高清一区色橹橹| 制服.丝袜.亚洲.另类.中文| 久久久精品免费免费| 一区二区三区在线免费观看| 久久99精品久久久久婷婷| av一区二区三区| 欧美电影免费观看高清完整版在线观看| 久久久午夜精品理论片中文字幕| 国产精品久久久久四虎| 老司机一区二区| 正在播放亚洲一区|