Microsoft.VisualStudio.Project.UnsafeNativeMethods.OpenClipboard C# (CSharp) Method

OpenClipboard() private method

private OpenClipboard ( IntPtr newOwner ) : int
newOwner System.IntPtr
return int
        internal static extern int OpenClipboard(IntPtr newOwner);

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Empties all the data structures added to the clipboard and flushes the clipboard.
        /// </summary>
        private void CleanAndFlushClipboard()
        {
            IOleDataObject oleDataObject = null;

            ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleGetClipboard(out oleDataObject));
            if (oleDataObject == null)
            {
                return;
            }


            string sourceProjectPath = DragDropHelper.GetSourceProjectPath(oleDataObject);

            if (!String.IsNullOrEmpty(sourceProjectPath) && NativeMethods.IsSamePath(sourceProjectPath, this.GetMkDocument()))
            {
                ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleFlushClipboard());
                int clipboardOpened = 0;
                try
                {
                    ErrorHandler.ThrowOnFailure(clipboardOpened = UnsafeNativeMethods.OpenClipboard(IntPtr.Zero));
                    ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.EmptyClipboard());
                }
                finally
                {
                    if (clipboardOpened == 1)
                    {
                        ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.CloseClipboard());
                    }
                }
            }
        }