开发者

how to call windows paint event from child thread

开发者 https://www.devze.com 2023-02-03 19:46 出处:网络
If I am wrong then please correct me as I am new in this. I have one thread which display image captured from webcam on a windows created using CreateWindowEx() function. Now when i execute my program

If I am wrong then please correct me as I am new in this. I have one thread which display image captured from webcam on a windows created using CreateWindowEx() function. Now when i execute my program I can see that my paint code (in WindowProc()) in never reached (called InvalidateRec开发者_开发技巧t() from child thread to redraw), checked using breakpoint.

Actually frame capture and display is being done in thread and I think because its in child thread and Window is in Main thread that is why its not able to call paint event.

Can you help me on this


Calling InvalidateRect() from a child thread should make your window redraw. However WM_PAINT is a low priority message, so it is possible that the window doesn't get redrawn if there is too much other activity. Have you tried putting a Sleep() into you processing thread to give the painting a chance to get done?

0

精彩评论

暂无评论...
验证码 换一张
取 消