LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear Clipboard contents

I have a LabView application that gets 3 values stuffed into the windows clipboard (2 text and one image).  If I call App.Clipboard.Get Image, I get the one of the text images.  I've tried stuffing a text string into the clipboard and all that does is add another count to the items in the clipboard.  I've found that .NET has a Clipboard.Clear Method, but when I try to create a .NET Constructor for Clipboard, the dialog informs me "This class contains no public constructors."  Since I only need the Image, I can clear all the contents out prior to copying my target Image to the clipboard and my application will work.  

 

To complicate things more, the application works as coded if I run the application from my development environment, but if I compile it to an EXE (my method of deployment), the application selects the text rather than the image.

 

I've attached screenshots of the .NET issue creating the constructor and the portion of my code.

 

Is there any means to purge the clipboard in LabView?

0 Kudos
Message 1 of 6
(1,073 Views)

I discovered that I was using the Win32 CountClipboardFormats and thought it was the number of clips.  Thus I'm not sure what's in the Clipboard for sure.  I know from the development environment that I get a clip of the front panel each time.  One might ask why I'm not using the LabView function that captures the front panel?  I found that I'm using an ActiveX video element on the front panel, and it's output is not captured by using the LabView function.

0 Kudos
Message 2 of 6
(1,043 Views)

For the moment, the App.Clipboard.Get Image is looking like the smoking gun.  I have been able to replace it with Win32 User calls and my application works in both development and EXE.  Continuing to test.  FWIW, this call failed in LabView versions 2017 and 2022.

0 Kudos
Message 3 of 6
(1,030 Views)

Check this post out. It has two seperate sets of functions. A simple function to just clear the clipboard using a LabVIEW VI Server method. This should work on all LabVIEW platforms.

 

The other two libraries control the Windows clipboard through WinAPI calls and the other is about handling Windows BMP files, which can be pulled from the clipboard or stored into it.

 

The first should be enough to work properly for your use case. The second is old, LabVIEW 6.0 or so, and therefore only works in LabVIEW 32-bit properly. I should probably revisit it and update it to LabVIEW 2009 to use proper pointer sized values for the various handles/pointers.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(1,008 Views)

New Version of the library in LabVIEW 2009 with adaptations to work for LabVIEW for Windows 32-bit and 64-bit.

 

Also changed the license from GPL to BSD 3-clause.

Rolf Kalbermatter
My Blog
Message 5 of 6
(1,002 Views)

I've found that .NET has a Clipboard.Clear Method, but when I try to create a .NET Constructor for Clipboard,

> the dialog informs me "This class contains no public constructors."

You don't need a constructor here, just use a method.

 

> App.Clipboard.Get Image

LabVIEW runtime engine doesn't support this function.  Read the manual.

 

 

George Zou
0 Kudos
Message 6 of 6
(995 Views)