How to intercept paste from clipboard into standard EDIT control with ATL and WTL

This sample project features subclassing EDIT control to intercept paste from clipboard and handle it programmatically. The sample fetches text from clipboard, converts it to upper case and replaces control’s selection with this text. There may be more specific handling, such as, for example, recognizing URL being pasted, splitting it into parts and filling multiple controls with URL parts (protocol, host, port, query etc.)

Keywords: CContainedWindow, ALT_MSG_MAP, WM_PASTE, CF_TEXT, GetClipboardData

Visual C++.NET 2003 source code can be downloaded here, compiled binary – here.

Leave a Reply