-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows剪贴板句柄占用问题]windows 11 剪切板写入图片报错 #55
Comments
你是不是系统中运行了其他管理剪贴板的软件 |
Windows 中剪贴板进程只能被一个线程持有,本库的逻辑是,在尝试写入之前,会尝试获得剪贴板句柄,获取到后,尝试写入,如果在这间隔之内,句柄被别人获取走了,或者压根没有获取到,就会报这个错 |
我也不清楚有没有其他的剪切板管理软件在运行,我一般是用windows自带的 windows + v 这个管理剪切板,这个会有影响吗, 我如果写入比较小的图片就能成功,但是写入比较大的就会出现这个错误,这种有没有其他解决方案 |
比较大是有多大?按理说不会出现这种情况,你的测试 demo 能贴一下完整的代码吗? |
我是做的一个截屏功能,截取一小部分区域写入就可以,截取大概超过1/4屏幕大小就会报错,在4k显示器上 |
@horou-dsk |
https://github.com/aamiros/screenshot.git 我单独提取了这一部分功能,在我这边debug模式下是稳定复现,不过release模式下,错误的概率就会小很多,还有就是存储到剪切板图片的颜色有问题 |
我发现是什么原因了,我装了有 uTools 这个软件,这个软件有一个剪切板历史的功能,应该是抢占了剪切板的句柄导致的,我把它关了似乎就没问题了 |
可以的,跟我的猜想一致,我把这个 issue 置顶了,后面有需要的朋友也可以看到 |
The problem | 问题描述
报错:set png image error, code = OSError(1418): 线程没有打开的剪贴板。
Release version | 版本
0.2.2
Operating system | 操作系统
Windows 11 26100.2605
Logs | 日志
set png image error, code = OSError(1418): 线程没有打开的剪贴板。
The text was updated successfully, but these errors were encountered: