亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩一区二区在线观看视频| 欧美韩国日本一区| 午夜国产不卡在线观看视频| 久久久久久久免费视频了| 日韩欧美视频在线| 国产精品2024| 亚洲精品一二三| 26uuu亚洲综合色欧美| 卡一卡二国产精品| 国产亚洲成av人在线观看导航| 亚洲精品在线免费观看视频| 免费在线一区观看| 91精品欧美福利在线观看 | 亚洲视频狠狠干| 亚洲尤物视频在线| 国产精品88av| 亚洲成人av一区二区| 亚洲乱码国产乱码精品精小说 | 欧美色倩网站大全免费| 另类中文字幕网| 久久电影网站中文字幕| 成人av中文字幕| 欧美一区二区三区四区视频| 国产精品久久久久久久蜜臀| 欧美日韩国产免费| 精品国产乱码久久久久久蜜臀| 久久久午夜精品理论片中文字幕| 欧美国产亚洲另类动漫| 玉米视频成人免费看| 国内精品视频666| 日韩激情中文字幕| 成人动漫精品一区二区| 欧美中文字幕一区二区三区| 欧美三级电影网站| 国产亚洲精品超碰| 成人国产一区二区三区精品| 奇米色777欧美一区二区| 国产日韩精品一区二区浪潮av| 欧美大度的电影原声| 日本不卡123| 欧美精品免费视频| 亚洲综合免费观看高清完整版| 在线观看视频一区二区欧美日韩| 色综合久久久久综合体| 色综合久久综合中文综合网| 亚洲视频在线一区| jizz一区二区| 香蕉成人啪国产精品视频综合网| av中文一区二区三区| jlzzjlzz亚洲日本少妇| 91精品办公室少妇高潮对白| 99精品欧美一区二区三区综合在线| 精品裸体舞一区二区三区| 精品一区二区av| 国产精品成人免费在线| 久久免费精品国产久精品久久久久| 在线视频一区二区免费| 欧美精品三级在线观看| 亚洲精品国产无天堂网2021 | 国产精品1区二区.| 无码av免费一区二区三区试看| 日韩精品亚洲一区二区三区免费| 欧美日韩你懂得| 日本美女一区二区三区| 国产精品第四页| 色综合久久久久久久久| 一区二区高清视频在线观看| 中文字幕在线观看一区| 精品制服美女丁香| 久久久av毛片精品| 欧美一区二区播放| 欧美刺激脚交jootjob| 欧美日韩精品一区二区三区四区 | 久久丝袜美腿综合| 在线观看日产精品| 精品国产123| 国产精品丝袜一区| 一区二区三区四区在线| 亚洲色图欧美激情| 欧美唯美清纯偷拍| 婷婷激情综合网| 看片的网站亚洲| 93久久精品日日躁夜夜躁欧美| 丁香激情综合国产| 91精品国产色综合久久不卡蜜臀 | 久久久噜噜噜久久人人看 | 暴力调教一区二区三区| 日韩亚洲欧美在线| 九九精品一区二区| 91精品国产综合久久精品| 日韩一级二级三级精品视频| 国产精品丝袜91| 天天影视涩香欲综合网| 色天使久久综合网天天| 久久综合视频网| 国产一区二区三区四区在线观看| 国产精品国产自产拍高清av | 国产精品自拍网站| 色欧美片视频在线观看| 91亚洲资源网| 国产网红主播福利一区二区| 久久超碰97人人做人人爱| 亚洲黄色性网站| 麻豆91精品91久久久的内涵| 久久99精品久久久久久 | 欧美日韩专区在线| 亚洲视频1区2区| 99国产精品久久久久久久久久| 亚洲黄色尤物视频| 久久精品欧美一区二区三区不卡 | 国产福利一区在线观看| 26uuu久久天堂性欧美| 99国产精品国产精品毛片| 亚洲精品国产精华液| 久久综合色8888| 成人免费毛片aaaaa**| 中文字幕免费不卡在线| 欧美人伦禁忌dvd放荡欲情| 午夜精品免费在线观看| 国产拍揄自揄精品视频麻豆| 91国产成人在线| 午夜精品福利久久久| 亚洲一级二级三级在线免费观看| 中文字幕一区二区三区乱码在线 | 国产欧美一区二区精品久导航| 成人av动漫网站| 亚洲综合一二区| 久久久久久亚洲综合影院红桃| 91丝袜美女网| 一本一道久久a久久精品| 久久er99精品| 久久综合色一综合色88| 91精品国产综合久久福利软件| 大桥未久av一区二区三区中文| 奇米色777欧美一区二区| 亚洲一区在线观看视频| 久久久99精品免费观看不卡| 日韩一区二区三区四区五区六区| av中文字幕在线不卡| 一区二区三区不卡在线观看 | 精品国产污污免费网站入口| 亚洲欧美国产77777| 亚洲欧美另类久久久精品| 日韩美女天天操| 91精品一区二区三区久久久久久| 日韩欧美亚洲一区二区| 国产精品麻豆欧美日韩ww| 国产精品久久久99| 亚洲欧美另类在线| 国产精品免费久久久久| 美女脱光内衣内裤视频久久网站 | 日韩av一区二区三区四区| 天堂蜜桃一区二区三区| 国产精品1024久久| 国产成人免费9x9x人网站视频| www.色精品| 国产成人av电影免费在线观看| 91亚洲精品一区二区乱码| www.性欧美| 色综合天天综合| 欧美tickling挠脚心丨vk| 亚洲一区av在线| 成人v精品蜜桃久久一区| 欧美电影免费观看完整版| 亚洲丝袜美腿综合| 同产精品九九九| 色综合激情五月| 中文字幕中文字幕中文字幕亚洲无线| 国产精品色在线| 天天av天天翘天天综合网 | 国产精品久久久久精k8| 一区二区三区波多野结衣在线观看 | 精品一区二区影视| 国产综合色在线视频区| 欧美精品tushy高清| 亚洲欧美成aⅴ人在线观看| 精品一区二区三区免费| 欧美日韩国产免费| 日本在线播放一区二区三区| 男女性色大片免费观看一区二区| 欧美日韩成人一区二区| 日韩综合小视频| 国产美女视频一区| 欧美在线看片a免费观看| 亚洲色图欧洲色图婷婷| 91精品福利在线| 狠狠色丁香婷婷综合久久片| 91精品国产免费久久综合| 亚洲午夜国产一区99re久久| 91在线小视频| 丝袜a∨在线一区二区三区不卡| 国产一区亚洲一区| 亚洲视频一二区| 制服丝袜在线91| www.亚洲国产| 日韩中文欧美在线| 国产精品素人一区二区| 欧美久久久久久久久久| 亚洲综合偷拍欧美一区色| 91精品国产色综合久久不卡蜜臀|