win32ui.error: CreateCompatibleDC failed

while trying to reproduce codes on PoE AI Part 4: Real-time Screen Capture and Plumbing, i encountered an error like this :

PS E:\tmp\game_assistant> python .\SSTime.py
Exception in thread Thread-1:
Traceback (most recent call last):
File “D:\Program Files\Anaconda3\lib\threading.py”, line 914, in _bootstrap_inner
self.run()
File “D:\Program Files\Anaconda3\lib\threading.py”, line 862, in run
self._target(*self._args, **self._kwargs)
File “E:\tmp\game_assistant\ScreenViewer.py”, line 114, in ScreenUpdateT
self.i1 = self.GetScreenImg()
File “E:\tmp\game_assistant\ScreenViewer.py”, line 69, in GetScreenImg
dataBitMap.CreateCompatibleBitmap(dcObj, w, h)
win32ui.error: CreateCompatibleDC failed

it is due to minimizing window, that is to say:

TLDR
TLDR
TLDR
you should unminimizing the required window, then the codes will run sucessfully.
TLDR
TLDR
TLDR

PS:

elasped time using two screen capture methods on my own pc:

direct method : 0.03 ~ 0.05 s

author’s method : 0.006 ~0.011 s

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值