private void _CloseFile()
        {
            // Close the file handle
            if (!_hFile.IsInvalid)
            {
                CloseHandle((IntPtr)_hFile);
                _hFile = HFILE.INVALID_HANDLE_VALUE;
            }

            // Release the IFileIsInUse instance which will remove it from the Running Object Table
            _pfiu = null;

            // Remove the file path from the dialog
            IDC_INFO.Text = c_szInstructions;
        }
 private void _OpenFile(string pszPath)
 {
     // Close the file if it is already opened
     _CloseFile();
     // Initialize the IFileIsInUse object. We use some default flags here as an example. If you modify these you will notice Windows
     // Explorer modify its File In Use dialog contents accordingly to match the usage type and available capabilities.
     _pfiu            = new CFileIsInUseImpl(Handle, pszPath, FILE_USAGE_TYPE.FUT_EDITING, OF_CAP.OF_CAP_CANCLOSE | OF_CAP.OF_CAP_CANSWITCHTO);
     _pfiu.CloseFile += (s, e) => _CloseFile();
     // The lack of FILE_SHARE_READ or FILE_SHARE_WRITE attributes for the dwShareMode parameter will cause the file to be locked from
     // other processes.
     _hFile = CreateFile(pszPath, Kernel32.FileAccess.FILE_GENERIC_READ, 0, null, FileMode.Open, FileFlagsAndAttributes.FILE_ATTRIBUTE_NORMAL | FileFlagsAndAttributes.FILE_FLAG_BACKUP_SEMANTICS);
     if (!_hFile.IsInvalid)
     {
         IDC_INFO.Text = pszPath;
     }
     else
     {
         _pfiu = null;
     }
 }