An example of anĀ external function. Registers a new clipboard format. This format can then be used as a valid clipboard format.

Namespace: SampleClassLibrary.Utils
Assembly: SampleClassLibrary (in SampleClassLibrary.dll)

<DllImport("user32", CharSet = CharSet.Ansi> _] 
Friend Shared Function RegisterClipboardFormat( _ 
ByVal lpszFormatName As String
) As UInt32
This language is not supported or no code example is available.
[DllImport("user32", CharSet = CharSet.Ansi)] 
internal static extern UInt32 RegisterClipboardFormat( 
string lpszFormatName 
)
This language is not supported or no code example is available.
[<DllImport("user32", CharSet = CharSet.Ansi)>] 
extern UInt32 RegisterClipboardFormat( 
lpszFormatName:string 
)
This language is not supported or no code example is available.
[DllImport("user32", CharSet = Ansi)] 
public private:  
static extern UInt32 RegisterClipboardFormat( 
String^ lpszFormatName 
)
This language is not supported or no code example is available.
In JScript, you cannot define your own external method with DllImport.
This language is not supported or no code example is available.

Parameters

lpszFormatName
Type: string

The name of the new format.

Return Value

Type: UInt32

If the function succeeds, the return value identifies the registered clipboard format.

If the function fails, the return value is zero.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Core

Supported in: 1.0, 1.1, 2.0

.NET Standard

Supported in: 2.0

Xamarin.Android

Supported in: 7.1

Portable Class Library

Supported in: Portable Class Library