public static bool IsCutPrefferdDropEffect( IntPtr hwnd = default ) { uint uFormat = PI.RegisterClipboardFormat( "Preferred DropEffect" ); bool flag = false; if( PI.OpenClipboard( hwnd ) ) { try { IntPtr clipboardData = PI.GetClipboardData( uFormat ); if( !( clipboardData != IntPtr.Zero ) ) { return flag; } IntPtr source = PI.GlobalLock( clipboardData ); try { if( source != IntPtr.Zero ) { byte[] destination = new byte[ 4 ]; Marshal.Copy( source, destination, 0, 4 ); flag = ( destination[ 0 ] & 2 ) != 0; } } finally { PI.GlobalUnlock( clipboardData ); } } finally { PI.CloseClipboard(); } } return flag; }
public static List<string> GetFileDropPaths( IntPtr hwnd = default ) { List<string> list = new List<string>(); if( PI.OpenClipboard( hwnd ) ) { try { IntPtr clipboardData = PI.GetClipboardData( PI.CF_HDROP ); if( !( clipboardData != IntPtr.Zero ) ) { return list; } IntPtr hDrop = PI.GlobalLock( clipboardData ); if( !( hDrop != IntPtr.Zero ) ) { return list; } try { uint num = PI.DragQueryFile( hDrop, uint.MaxValue, null, 0 ); if( num > 0 ) { for( uint i = 0; i < num; i++ ) { const int MAX_PATH = 260; StringBuilder lpszFile = new StringBuilder( MAX_PATH ); PI.DragQueryFile( hDrop, i, lpszFile, lpszFile.Capacity ); if( lpszFile.Length > 0 ) { list.Add( lpszFile.ToString() ); } } } return list; } finally { PI.GlobalUnlock( clipboardData ); } } finally { PI.CloseClipboard(); } } return list; }