[DllImport("user32.dll")]
static extern IntPtr GetClipboardData(uint uFormat);
None.
Do you know one? Please contribute it!
None.
Please add some!
[DllImport("user32.dll")]
static extern IntPtr GetClipboardData(uint uFormat);
/// <summary>
/// Gets the data on the clipboard in the format specified by ClipboardDataFormat
/// </summary>
private String GetClipboardData(int ClipboardDataFormat)
{
if (ClipboardDataFormat != 0)
{
OpenClipboard(Handle);
//Get pointer to clipboard data in the specified format
IntPtr ClipboardDataPointer = GetClipboardData((uint)ClipboardDataFormat);
//Do a bunch of crap necessary to copy the data from the memory
//the above pointer points at to a place we can access it.
UIntPtr Length = GlobalSize(ClipboardDataPointer);
IntPtr gLock = GlobalLock(ClipboardDataPointer);
//Init a buffer which will contain the clipboard data
byte[] Buffer = new byte[(int)Length];
//Copy clipboard data to buffer
Marshal.Copy(gLock, Buffer, 0, (int)Length);
CloseClipboard();
//Convert clipboard data to string
string ClipboardData = ASCIIEncoding.ASCII.GetString(Buffer);
return ClipboardData;
}
return "";
}