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

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

?? editfilters.cpp

?? VisualC OPC Client Example C 程序開發
?? 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网站在线| 韩国女主播一区| 国产成人精品免费在线| 欧美午夜精品电影| 国产精品国产三级国产| 精品在线播放免费| 88在线观看91蜜桃国自产| 最新国产精品久久精品| 国产成人综合在线播放| 日韩欧美高清dvd碟片| 在线区一区二视频| 国产精品美女久久久久aⅴ| 久久精品国产第一区二区三区| 91国偷自产一区二区使用方法| 国产精品乱码久久久久久 | 91精品国产91久久久久久最新毛片 | 欧美肥妇bbw| 亚洲综合男人的天堂| 成人精品视频一区二区三区| 精品欧美久久久| 日韩不卡一区二区| 欧美日韩免费视频| 玉米视频成人免费看| 99久久久久久| 国产精品久久久久久久浪潮网站| 国内精品视频666| 日韩欧美一区在线| 青青草国产成人av片免费| 欧美亚洲国产一区在线观看网站| 中文字幕一区二区三区在线播放 | 国产超碰在线一区| 久久精品一级爱片| 国产成人亚洲精品青草天美| 26uuu国产日韩综合| 久久99精品国产.久久久久久| 91精品国产综合久久久久久漫画 | 日本系列欧美系列| 欧美一级日韩免费不卡| 日韩欧美三级在线| 日韩国产精品91| 日韩女优av电影| 男男gaygay亚洲| 日韩视频一区二区在线观看| 免费成人在线观看视频| 日韩一区二区视频在线观看| 免费在线看成人av| 欧美va日韩va| 国产一区二区三区香蕉| www国产精品av| 从欧美一区二区三区| 国产精品女同一区二区三区| 成人激情免费电影网址| 中文字幕在线不卡一区| 91久久久免费一区二区| 亚洲第一福利视频在线| 日韩欧美在线1卡| 国产乱码精品一品二品| 国产精品视频一二三| 不卡的电视剧免费网站有什么| 中文字幕欧美一| 欧美偷拍一区二区| 日本麻豆一区二区三区视频| 精品免费国产一区二区三区四区| 国产99一区视频免费| 国产精品美女久久福利网站| 91蜜桃传媒精品久久久一区二区| 亚洲欧美日韩国产另类专区| 免费欧美日韩国产三级电影| 久久免费精品国产久精品久久久久| 国产盗摄一区二区三区| 亚洲伦理在线精品| 欧美一区二区在线视频| 国产精品自拍在线| 亚洲欧美激情小说另类| 91精品婷婷国产综合久久| 国产馆精品极品| 一区二区三区日韩欧美精品| 日韩一区二区三免费高清| 国产成人av电影在线| 亚洲精选视频免费看| 欧美一级专区免费大片| gogo大胆日本视频一区| 欧美一区日韩一区| 成人免费看片app下载| 亚洲综合成人在线| 欧美成人福利视频| hitomi一区二区三区精品| 午夜久久久久久久久久一区二区| 久久综合久久鬼色| 欧洲国产伦久久久久久久| 久久99久久99| 1000部国产精品成人观看| 欧美一区二区精品| 91小视频免费观看| 蜜桃av一区二区| 亚洲欧美日韩国产手机在线| 精品免费一区二区三区| 色嗨嗨av一区二区三区| 国产一区欧美一区| 亚洲自拍偷拍图区| 中文字幕不卡一区| 欧美丰满高潮xxxx喷水动漫| 成人av资源站| 精品亚洲porn| 亚洲一区二区三区在线播放| 久久精品免费在线观看| 欧美日韩精品电影| 成人高清av在线| 久久99精品久久只有精品| 一区二区三区在线观看网站| 久久久蜜桃精品| 欧美男女性生活在线直播观看| 成人av电影免费在线播放| 日韩黄色小视频| 亚洲激情图片小说视频| 久久精品视频在线免费观看| 日韩一区二区影院| 欧美性受xxxx黑人xyx性爽| 成人av在线看| 国产原创一区二区三区| 奇米影视在线99精品| 一区二区成人在线| 亚洲丝袜制服诱惑| 亚洲国产成人自拍| 26uuu亚洲综合色欧美| 日韩一区二区电影在线| 欧美天天综合网| 91小视频免费观看| 成人动漫在线一区| 国产高清久久久| 国产尤物一区二区在线 | 国产美女精品一区二区三区| 午夜天堂影视香蕉久久| 亚洲欧美视频在线观看| 国产清纯在线一区二区www| 日韩精品综合一本久道在线视频| 欧美日韩亚洲综合在线| 在线视频中文字幕一区二区| 91日韩在线专区| a级高清视频欧美日韩| 成人午夜精品一区二区三区| 国产一区视频网站| 国内精品国产三级国产a久久| 蜜臀久久99精品久久久久久9| 亚洲福利视频导航| 亚洲国产成人av网| 亚洲高清免费一级二级三级| 亚洲综合清纯丝袜自拍| 亚洲一区二区在线免费观看视频| 亚洲欧美日韩成人高清在线一区| 成人欧美一区二区三区1314| 国产精品乱码一区二区三区软件| 国产精品少妇自拍| 国产精品视频在线看| 国产三级精品三级在线专区| 国产女人aaa级久久久级| 国产欧美日韩在线观看| 国产人伦精品一区二区| 国产精品午夜久久| 亚洲欧洲www| 亚洲精品videosex极品| 一级特黄大欧美久久久| 亚洲国产成人av网| 日韩中文字幕麻豆| 狂野欧美性猛交blacked| 国产中文字幕精品| 国产精品一区二区x88av| 国产成人啪免费观看软件| 国产成人高清视频| 成人av电影免费在线播放| 91天堂素人约啪| 欧美亚洲国产一区二区三区va | 国产精品一二三四区| 成人午夜看片网址| 91理论电影在线观看| 欧美调教femdomvk| 日韩精品中文字幕在线不卡尤物| 精品国产一区二区精华| 欧美激情一区三区| 亚洲婷婷国产精品电影人久久| 麻豆视频一区二区| 精品一区二区三区久久久| 国产精品一区不卡| 色哟哟国产精品| 欧美日韩国产免费一区二区 | 在线观看91av| 精品动漫一区二区三区在线观看| 久久久精品国产免大香伊| 中文字幕一区日韩精品欧美| 一区二区免费在线| 精品成人一区二区三区| 国产精品免费视频网站| 亚洲午夜精品17c| 国产在线不卡一区| 色哟哟亚洲精品| 欧美www视频| 中文字幕一区二区三区不卡 | 天天综合网 天天综合色| 国产另类ts人妖一区二区| 91麻豆精品在线观看|