ClipboardProxy Class

 

Provides methods for manipulating the Clipboard.

Namespace:   Microsoft.VisualBasic.MyServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

System.Object
  Microsoft.VisualBasic.MyServices.ClipboardProxy

[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)]
public class ClipboardProxy

NameDescription
System_CAPS_pubmethodClear()

Clears the Clipboard.

System_CAPS_pubmethodContainsAudio()

Indicates whether the Clipboard contains audio data.

System_CAPS_pubmethodContainsData(String)

Indicates whether the Clipboard contains data in the specified custom format.

System_CAPS_pubmethodContainsFileDropList()

Returns a Boolean indicating whether the Clipboard contains a file drop list.

System_CAPS_pubmethodContainsImage()

Returns a Boolean indicating whether an image is stored on the Clipboard.

System_CAPS_pubmethodContainsText()

Determines if there is text on the Clipboard.

System_CAPS_pubmethodContainsText(TextDataFormat)

Determines if there is text on the Clipboard.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetAudioStream()

Retrieves an audio stream from the Clipboard.

System_CAPS_pubmethodGetData(String)

Retrieves data in a custom format from the Clipboard.

System_CAPS_pubmethodGetDataObject()

Retrieves data from the Clipboard as an IDataObject.

System_CAPS_pubmethodGetFileDropList()

Retrieves a collection of strings representing file names from the Clipboard.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetImage()

Retrieves an image from the Clipboard.

System_CAPS_pubmethodGetText()

Retrieves text from the Clipboard.

System_CAPS_pubmethodGetText(TextDataFormat)

Retrieves text from the Clipboard.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodSetAudio(Byte[])

Writes audio data to the Clipboard.

System_CAPS_pubmethodSetAudio(Stream)

Writes audio data to the Clipboard.

System_CAPS_pubmethodSetData(String, Object)

Writes data in a custom format to the Clipboard.

System_CAPS_pubmethodSetDataObject(DataObject)

Writes a DataObject to the Clipboard.

System_CAPS_pubmethodSetFileDropList(StringCollection)

Writes a collection of strings representing file paths to the Clipboard.

System_CAPS_pubmethodSetImage(Image)

Writes an image to the Clipboard.

System_CAPS_pubmethodSetText(String)

Writes text to the Clipboard.

System_CAPS_pubmethodSetText(String, TextDataFormat)

Writes text to the Clipboard.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

Items moved or copied to the Clipboard persist even after the application is shut down.

Data on the Clipboard can be in any data format, also called a Clipboard format. For a list of predefined formats to use with the Clipboard, see DataFormats. When an item is moved or copied to the Clipboard, items in other formats are cleared. To make other formats persist, use DataObject, which copies everything existing on the current Clipboard, including items pasted from other applications. Place data on the Clipboard in multiple formats to maximize the possibility that a target application, whose format requirements you might not know, can successfully retrieve the data.

Because all Windows applications share the system Clipboard, the contents may change when you switch to another application.

A class must be serializable for it to be put on the Clipboard. See Serialization (C# and Visual Basic) for more information.

When accessing the Clipboard remotely, a ThreadStateException is thrown unless the accessing thread operates in STA (single-threaded apartment) mode. To resolve this issue, set the ThreadApartmentState to STA. For more information, see STAThreadAttribute.

For more information, see Storing Data to and Reading from the Clipboard (Visual Basic).

Project type

Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

No

Windows Service

Yes

Web Site

No

This example reads text from the Clipboard into the string textOnClipboard.

Dim textOnClipboard As String = My.Computer.Clipboard.GetText()

This example will fail if there is no text on the Clipboard.

.NET Framework
Available since 2.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: