Solved

RichEdit prohibit copy to clipboard

Posted on 2008-06-20
2
327 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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 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