Re:Re: paste contents of clipboard into external app with Delphi

Posted by webmaster Guido on January 21, 2004

In Reply to: Re: paste contents of clipboard into external app posted by 12167 Stefan Loeners on January 19, 2004

: I found it. Using Fred Schetterer's Sendkeys component (fschetterer@fredsterware.com), and the following syntax, I am able to paste the contents of the clipboard into any application.
: sendkey.sendkeysToTopWindow(^v, nil, Pchar(sWindow));
: Thank you for having shared thoughts with me on this tough one ;)

Well, with Delphi, nor with any other application, you can NOT "paste" anything in another application. You can only put something on the clipboard and let the other application copy it from there.

So that leaves two other ways for directly sending information to another application:

1. Send keystrokes, as you have found already. That's the easiest solution, and works well with apps such as Word that can be commanded entirely by keystrokes.

Note: it's a lot more difficult to send mouseclicks, because you have to find out where the elements to be clicked are to be found on the screen... but nonetheless, it's also possible.

2. Send data over an OLE connection, if the other app is capable of receiving OLE data. For this, you have to write an OLE-server into your app. This is not a trivial task. And what makes it still more complicated, is the fact that there can be different versions of the client-app around (such as Word 6, 8, etc) that expect data in a different form.

Regards,
webmaster Guido


[ Delphi Forum ]