-
How to Intercept Paste?
I am working on a textbox based ActiveX control for use in a project. If performs a variety of tasks to limit user input including: whether numbers or letters should be accepted, max length of text input.
Everything works fine unless a user decides to paste data from the clipboard, which bypasses the KeyPress event. Is there a way to intercept the data for validation before it is pasted? My first thought was to create a cancellable _OnPaste() event for my usercontrol. Unfortunately I am not sure how to go about doing this.
Any help would be appreciated.
David
-- Update --
I was able to do what I needed by tweaking this example from the MS Knowledge Base:
http://support.microsoft.com/support.../Q179/3/98.ASP
I replaced the <hWnd> parameters in the SubClass() subroutine with txtBaseBox.hWnd and tested for the WM_PASTE message in the WindowProc() function.
I decided against adding a paste event as it proved unnecessary.
---------------