开发者

How to detect a Paste operation in a textbox?

开发者 https://www.devze.com 2022-12-24 13:22 出处:网络
I want to detect when the user pasted something into the textbox.I want to detect it whether the user used the mouse or keyboard.

I want to detect when the user pasted something into the textbox. I want to detect it whether the user used the mouse or keyboard.

This is v开发者_C百科b6


Karl E. Peterson's HookXP is a pretty cool code sample that shows you how to capture a paste event, along with a bunch of other interesting stuff. I modified and stripped it down a bit, and was able to do what you asked, so I can vouch that it works. I'd post it here, but I'd be violating his license.


I think the only way to do this is to subclass the textbox and detect the WM_PASTE event.

0

精彩评论

暂无评论...
验证码 换一张
取 消