Search

Everything stated on this site is, of course, MY opinion / statement / thought, unless specifically stated otherwise. You knew that.

Blog Index
The journal that this archive was targeting has been deleted. Please update your configuration.
Navigation
« Notes-Domino blogs: around the world | Main | April Fool's - a day later »
Wednesday
Apr022003

WinAPI from LS to copy to Windows clipboard

Here is some LotusScript that uses the Windows API to copy text to the Windows clipboard (of course, the clipboard will handle pretty much anything, but this example is for text).

Before getting to the actual code, I must state that I can take no credit at all for the code in this posting; it was found here. As my buddy Scott (a.k.a. "Sparky") would say, this was all R&D ("Rob and Duplicate"). But that's the sign of an efficient developer, right?

In this case, I put the bulk of the code in a script library, put a computed field on the Notes form to hold the constructed text that the content owners needed (for pasting into some hotspot urls later), and put a simple call in a form action button to allow the user to just click a button to get the needed text. Here's the script library.

Be sure to list the script library in your form's Global Declarations:
Option Public
Option Explicit
Use "libWindowsClipboard"
And then simply add code similar to this wherever you want to invoke the routine:
Sub Click(Source As Button)
Dim varRet As Variant
Dim strText As String
strText = doc.txtLinkInfo(0)

' Call script library function to use WinAPI to copy strText to Windows clipboard
varRet = fSendToClipboard( strText )

End Sub
Update: Ben Poole has a post with several tasty WinAPI tidbits. Well worth a read.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.