How about using OpenFile() with OF_SHARE_EXCLUSIVE? I think it is better
since using CreateFile, if successful, I have to delete the file, and my
purpose is only to check whether some file is opened (used) or not.
=========================================================
Hi Victor,
How about using OpenFile() with OF_SHARE_EXCLUSIVE? If successful, I need to
close the file.
regards,
=========================================================
Hi George,
Please *read the complete* documentation: you can call CreateFile in a way
that it will only open a file if it already exists, so that no file is
created.
=========================================================
Thanks SvenC,
For CreateFile, it only has option OPEN_EXISTING to check whether a file is
existing or not, but no exclusive mode checking to see whether the existing
file is used (opened) by any other thread/process.
/en-us/library/
Any comments?
=========================================================
Hi George,
Pass 0 to dwShareMode and you disallow sharing.
--
SvenC
=========================================================
相关文章
- 如何检查文件正在被使用
- linux下如何使用sftp命令进行文件上传和下载
- window 如何使用命令行运行.exe文件?
- 如何使用 Python 进行文件读写操作?
- 在重新生成解决方案时,出现的错误:无法将文件“obj\x86\Debug\*.exe”复制到“obj\Debug\*.exe”。文件正由另一进程使用,因此该进程无法访问此文件
- 如何使用python处理nc数据制作Mike风场文件--以ERA5数据为例
- sonar代码检查_测试工程师的福音-如何使用Sonar完成代码质量检测
- Nginx使用try_files检查文件是否存并配置返回重定向页面或状态码
- 如何使用 checksec 检查 Linux 系统的安全特性
- pdf文件太大如何变小?-方法一:使用“星优文件压缩器”软件将pdf压缩变小