|
-
Jul 24th, 2001, 02:15 PM
#1
Thread Starter
New Member
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.
---------------
Last edited by iamdavid; Jul 26th, 2001 at 05:35 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|