EndUpdateResource()引发错误110当在输出位置打开Windowsexplorer时,系统无法打开指定的设备或文件 [英] EndUpdateResource() throws Error 110 The system cannot open the device or file specified when windowsexplorer is open at the output location

查看:747
本文介绍了EndUpdateResource()引发错误110当在输出位置打开Windowsexplorer时,系统无法打开指定的设备或文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码仅在将可执行文件复制到以下位置的D:\ test \ output \中打开Windows资源管理器时,在EndUpdateResource调用上引发110错误.

The following code throws a 110 Error on the EndUpdateResource call only when windows explorer is open at D:\test\output\ where the executable is being copied to:

std::ifstream in("C:\\Windows\\notepad.exe", std::ios::binary);
std::ofstream out("D:\\test\\output\\notepad.exe", std::ios::binary);
out << in.rdbuf();
in.close();
out.close();

Handle hUpdateRes = BeginUpdateResource(_T("D:\\test\\output\\notepad.exe"), FALSE);
EndUpdateResource(hUpdateRes, FALSE);

只要我没有在Windows资源管理器中打开该文件夹,它就可以正常工作.如果我打开它,将抛出错误.另外,如果我在BeginUpdateResource调用之前执行了具有读写访问权限的CreateFile,即使打开了输出文件夹,它也可以正常工作.我真的很困惑,不胜感激.谢谢!

As long as I don't have that folder open in windows explorer it works fine. If I have it open it will throw an error. Also, if I do a CreateFile with read and write access before the BeginUpdateResource call it will work fine even if I have the output folder open. I am really confused and would appreciate any help. Thanks!

推荐答案

我在计算机上禁用了按需病毒扫描程序,并且代码不再引发错误.

I disabled the on demand virus scanner on the machine and the code no longer throws an error.

这篇关于EndUpdateResource()引发错误110当在输出位置打开Windowsexplorer时,系统无法打开指定的设备或文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆