Microsoft.KtmIntegration.NativeMethods.HandleCOMError C# (CSharp) Méthode

HandleCOMError() static private méthode

static private HandleCOMError ( int error ) : void
error int
Résultat void
        internal static void HandleCOMError(int error)
        {
            //Console.WriteLine("Got error {0}", error);
            throw new System.ComponentModel.Win32Exception(error);
        }

Usage Example

        public static bool Move(string sourceFileName, string destFileName)
        {
            using (TransactionScope scope = new TransactionScope())
                using (KtmTransactionHandle ktmTx = KtmTransactionHandle.CreateKtmTransactionHandle())
                {
                    // Allow copying to different volumes and to replace existing files
                    NativeMethods.MoveFileFlags moveFlags =
                        NativeMethods.MoveFileFlags.MOVEFILE_COPY_ALLOWED |
                        NativeMethods.MoveFileFlags.MOVEFILE_REPLACE_EXISTING;

                    bool status = NativeMethods.MoveFileTransacted(
                        sourceFileName,
                        destFileName,
                        IntPtr.Zero,
                        IntPtr.Zero,
                        moveFlags,
                        ktmTx);

                    if (!status)
                    {
                        NativeMethods.HandleCOMError(Marshal.GetLastWin32Error());
                    }

                    scope.Complete();
                    return(status);
                }
        }
All Usage Examples Of Microsoft.KtmIntegration.NativeMethods::HandleCOMError