简体   繁体   中英

Receive a message when paste time using delphi

How can i receive a message when the user paste anything like txt ,... to desktop or anywhere else and not only inside my delphi application. I need paste message when it doing from popup menu and pressing Ctrl+V . Something like the below code :

if (Msg.Message = WM_PASTE) Then
 ShowMessage('Paste');

Imagine an application that has two buttons that one of theme[button1] doing paste from clipboard and another one[button2] doing paste some text from memo1 [I added some text to this memo] to everywhere. the problem is when i doing copy anything to clipboard and then do paste it, next if i do paste by clicking on the button2 ill miss my last clipboard value. I added another memo2 [This memo is my alternative clipboard] and when doing paste by clicking on first button i also paste it into memo2. In the next step i click on button2 this must do paste memo1 value to everywhere that i want now i can also copy the memo2 value to clipboard because i am going to use it again. I can do it if i want to do paste like button2 but if i do paste inside desktop need to detect paste time. An important thing i have to use copy paste instead of send keystroke .

Try to google about windows hooks like (hook a service to keyboard) or (Intercept Keyboard Input) and you can start from there.

take a look on this it might be useful too:

How to monitor the keyboard above all other applications and then send other keys to them instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM