Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions WinApi/User32/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5230,5 +5230,28 @@ public enum WM
USER = 0x0400
}

public enum ClipboardFormat : uint
{
/// <summary>
/// A handle to a bitmap (HBITMAP)
/// </summary>
CF_BITMAP = 2u,

/// <summary>
/// Flag for text-format
/// </summary>
CF_TEXT = 1u,

/// <summary>
/// Flag for unicode-text-format
/// </summary>
CF_UNICODETEXT = 13u,

/// <summary>
/// no format
/// </summary>
CF_ZERO = 0u
}

#endregion
}
56 changes: 56 additions & 0 deletions WinApi/User32/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,61 @@ public static extern int GetMessage(out Message lpMsg, IntPtr hwnd, uint wMsgFil
public static extern bool PostThreadMessage(uint threadId, uint msg, IntPtr wParam, IntPtr lParam);

#endregion

#region Clipboard Functions

/// <summary>
/// Opens the clipboard for examination and prevents other applications from modifying the clipboard content.
/// </summary>
/// <param name="hWndNewOwner">A handle to the window to be associated with the open clipboard. If this parameter is NULL, the open clipboard is associated with the current task.</param>
/// <returns>If the function succeeds, the return value is nonzero.</returns>
[DllImport(LibraryName, ExactSpelling = true)]
public static extern bool OpenClipboard(IntPtr hWndNewOwner);
/// <summary>
/// Closes the clipboard.
/// </summary>
/// <returns>If the function succeeds, the return value is nonzero.</returns>
[DllImport(LibraryName, ExactSpelling = true)]
public static extern bool CloseClipboard();
/// <summary>
/// Retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.
/// </summary>
/// <param name="uFormat">A clipboard format.</param>
/// <returns>If the function succeeds, the return value is the handle to a clipboard object in the specified format.</returns>
[DllImport(LibraryName, ExactSpelling = true)]
public static extern IntPtr GetClipboardData(uint uFormat);

/// <summary>
/// Places data on the clipboard in a specified clipboard format. The window must be the current clipboard owner, and the application must have called the OpenClipboard function
/// </summary>
/// <param name="uFormat">The clipboard format</param>
/// <param name="handle">A handle to the data in the specified format</param>
/// <returns>If the function succeeds, the return value is the handle to the data.</returns>
[DllImport(LibraryName, ExactSpelling = true)]
public static extern IntPtr SetClipboardData(uint uFormat, IntPtr handle);

/// <summary>
/// Empties the clipboard and frees handles to data in the clipboard. The function then assigns ownership of the clipboard to the window that currently has the clipboard open.
/// </summary>
/// <returns></returns>
[DllImport(LibraryName, ExactSpelling = true)]
public static extern bool EmptyClipboard();

[DllImport(LibraryName, ExactSpelling = true)]
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);

[DllImport(LibraryName, ExactSpelling = true)]
public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);

[DllImport(LibraryName, ExactSpelling = true)]
public static extern bool AddClipboardFormatListener(IntPtr hwnd);

[DllImport(LibraryName, ExactSpelling = true)]
public static extern int GetPriorityClipboardFormat(IntPtr paFormatPriorityList, int cFormats);

[DllImport(LibraryName, ExactSpelling = true)]
public static extern uint EnumClipboardFormats(uint format);

#endregion
}
}