Click here to Skip to main content
15,891,033 members
Articles / Desktop Programming / MFC

MessageSender

Rate me:
Please Sign up or sign in to vote.
4.94/5 (80 votes)
24 Aug 20043 min read 115K   5.6K   122  
Utility that allows sedning of window messages to a selected window from both MessageSender and target window thread context
#if !defined(AFX_FILTEREDEDIT_H__0298DD16_6401_406E_BF38_03C2F6267359__INCLUDED_)
#define AFX_FILTEREDEDIT_H__0298DD16_6401_406E_BF38_03C2F6267359__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
using namespace std;
// FilteredEdit.h : header file
//

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CNegativeNumEdit window

class CNegativeNumEdit : public CEdit
{
// Construction
public:
	CNegativeNumEdit()	{};
	virtual ~CNegativeNumEdit()	{};

	int WndTextToNumber();
	void NumberToWndText(UINT unNumber);
	virtual bool IsValid(bool bPresenceRequired = true);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CNegativeNumEdit)
	//}}AFX_VIRTUAL

	// Generated message map functions
protected:
	//{{AFX_MSG(CNegativeNumEdit)
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CNum16Edit window

class CNum16Edit : public CEdit
{
// Construction
public:
	CNum16Edit()	{};
	virtual ~CNum16Edit()	{};

	UINT WndTextToNumber();
	void NumberToWndText(UINT unNumber);
	virtual bool IsValid(bool bPresenceRequired = true);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CNum16Edit)
	//}}AFX_VIRTUAL

	// Generated message map functions
protected:
	//{{AFX_MSG(CNum16Edit)
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CUintCommaEdit window

class CUintCommaEdit : public CEdit
{
// Construction
public:
	CUintCommaEdit()	{};
	virtual ~CUintCommaEdit()	{};

	void WndTextToNumbers(vector<UINT> * vunNumbers = 0, bool bAddContent = false);
	void NumbersToWndText(vector<UINT> * vunNumbers);
	virtual bool IsValid()	{WndTextToNumbers();	return m_bValid;}

private:
	bool m_bValid;	// is valid content; WndTextToNumbers must be called to set value

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CUintCommaEdit)
	//}}AFX_VIRTUAL

protected:
	//{{AFX_MSG(CUintCommaEdit)
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CUintEdit window

class CUintEdit : public CEdit
{
// Construction
public:
	CUintEdit()		{};
	virtual ~CUintEdit()	{};

	UINT WndTextToNumber();
	void NumberToWndText(UINT unNumber);
	virtual bool IsValid(bool bPresenceRequired = true);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CUintEdit)
	//}}AFX_VIRTUAL

	// Generated message map functions
protected:
	//{{AFX_MSG(CUintEdit)
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FILTEREDEDIT_H__0298DD16_6401_406E_BF38_03C2F6267359__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions