简体   繁体   English

使用delphi粘贴时间时收到消息

[英]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.当用户将诸如txt 之类的内容粘贴到桌面或其他任何地方而不仅仅是在我的delphi应用程序中时,我如何才能收到消息。 I need paste message when it doing from popup menu and pressing Ctrl+V .当它从弹出菜单中执行并按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.想象一个有两个按钮的应用程序,其中一个是 theme[button1] 从剪贴板粘贴,另一个 [button2] 从 memo1 [我添加了一些文本到这个备忘录]到任何地方粘贴一些文本。 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.问题是当我将任何内容复制到剪贴板然后粘贴它时,接下来如果我通过单击按钮 2 粘贴我会错过我最后一个剪贴板值。 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.我添加了另一个 memo2 [这个备忘录是我的替代剪贴板],当通过单击第一个按钮进行粘贴时,我也将其粘贴到 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.在下一步中,我单击 button2 这必须将 memo1 值粘贴到我现在想要的任何地方,我还可以将 memo2 值复制到剪贴板,因为我将再次使用它。 I can do it if i want to do paste like button2 but if i do paste inside desktop need to detect paste time.如果我想像 button2 那样粘贴,我可以这样做,但是如果我在桌面内粘贴需要检测粘贴时间。 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.尝试在 google 上搜索诸如(将服务连接到键盘)或(拦截键盘输入)之类的 Windows 钩子,然后您可以从那里开始。

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 如何在所有其他应用程序之上监视键盘,然后将其他键发送给它们

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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