Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RichEdit prohibit copy to clipboard

Posted on 2008-06-20
2
Medium Priority
?
353 Views
Last Modified: 2013-11-20
I have become convinced to use CRichEdit for displaying and printing our reports.  My problem is that some of the reports contain financial/auditing data.  I'm concerned that a user could ^C an entire financial report, paste it to WordPad, and then alter the data.  It would NEVER work long term, but, even in the short term, it could be a real problem.

Is there a way to keep the user from performing a copy operation on a RichEdit control?

Thanks, rick
0
Comment
Question by:rickatseasoft
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 21834787
you have to derive your own control class, and override the PreTranslateMessage function:


BOOL CMyRichEdit::PreTranslateMessage(MSG* pMsg) 
{
 	// disable copy by mouse or keyboard
	switch( pMsg->message )
	{
	case WM_KEYDOWN:
		if ( pMsg->wParam==67 && GetKeyState(VK_CONTROL) )
			return true;
		break;
	case WM_RBUTTONDOWN:
		return true;
	}
	
	return CMyRichEdit::PreTranslateMessage(pMsg);
}

Open in new window

0
 

Author Closing Comment

by:rickatseasoft
ID: 31469122
PERFECT!

Thanks, Rick
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question