[DllImport("user32.dll")]
static extern IntPtr GetClipboardData(uint uFormat);
None.
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 the selected item of the specified listbox.
/// </summary>
private byte[] GetClipboardData(ListBox ListBox)
{
uint SelectedFormat = GetSelectedClipboardFormat(ListBox);
if (SelectedFormat != 0)
{
OpenClipboard(Handle);
//Get pointer to clipboard data in the selected format
IntPtr ClipboardDataPointer = GetClipboardData(SelectedFormat);
//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);
GlobalUnlock(gLock); //unlock gLock
CloseClipboard();
return Buffer;
}
return new byte[] {};
}
Do you know one? Please contribute it!