在自动复选框绘制新状态之前,将执行BN_CLICKED中耗时的代码 [英] Time-consuming code in BN_CLICKED executes before an automatic check box draws the new state
问题描述
是否存在建议的方法来获取自动绘制其新状态的复选框 之前 a 耗时的操作?
Is there a recommended way to get a automatic check box to draw its new state before a time-consuming operation?
案例BN_CLICKED:
//发送 BM_GETCHECK 此处返回 新状态,但是
// Sending BM_GETCHECK here returns the new state, but
//该复选框尚未绘制,所以
takesAfewSeconds();
takesAfewSeconds(); // Makes it look like the click didn’t “take”
break;
//稍后可能在DefDlgProc中绘制复选框? 跨度>
// Check box draws later, maybe in DefDlgProc?
推荐答案
在复选框上调用UpdateWindow可能会对其进行绘制-值得尝试.
Calling UpdateWindow on the check box might paint it - it's worth a try.
推荐的方法是在辅助线程中执行耗时的操作.
The recommended way would be to perform the time-consuming operation in a secondary thread.
这篇关于在自动复选框绘制新状态之前,将执行BN_CLICKED中耗时的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!