LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer data using the clipboard

Does anyone know how to transfer data (string) from the clipboard to labview?
I am trying to write C++ code using win32 API using the calls, OpenClipboard, Getclipboard and CloseClipboard functions. The problem is LV crashes when there is a call to the library function. Perhaps I am going about this the wrong way.
Any ideas are appreciated.
0 Kudos
Message 1 of 3
(3,352 Views)
Hpopenoe wrote:

> Does anyone know how to transfer data (string) from the clipboard to
> labview?
> I am trying to write C++ code using win32 API using the calls,
> OpenClipboard, Getclipboard and CloseClipboard functions. The problem
> is LV crashes when there is a call to the library function. Perhaps
> I am going about this the wrong way.
> Any ideas are appreciated.

There are VI available for this purpose. Why reinvent the wheel?
Visit MoreGoodIdea site at:
http://www.mooregoodideas.com/

you'll find it.

Regards,

George Zou
http://gtoolbox.yeah.net
0 Kudos
Message 2 of 3
(3,352 Views)
Perhaps this approach will give you the answer. I wrote a VI that uses the Win32 API directly. It calls OpenClipboard with the calling VI's window handle, then calls GetClipboard with the GW_TEXT constant to get a memory block handle. I lock the memory block with GlobalLock so other applications can't mess with it. I next call lstrcopynA , initializing a arg1 as a C String with 256 bytes and using the memory block handle as arg2, with the length of arg1 minus one as arg3. Your clipboard text is in the string output. Now call GlobalUnlock and CloseClipboard and you're done!
0 Kudos
Message 3 of 3
(3,352 Views)