当前位置: 动力学知识库 > 问答 > 编程问答 >

winapi - WPF host Win32 window frozen because of multiple WM_NCHITTEST when moving mouse over the bottom right corner

问题描述:

I have a WPF window that hosts Win32 window, I have class inherited from HwndHost.

Everything seems to work fine except when I move the mouse over the bottom right corner of the WPF window, the window freezes.

I used Spy++ to see what is going on. It turns out that the WPF Window receives few WM_WINDOWPOSCHANGING messages every 2-3 seconds and the Win32 Window keeps receiving a lot of WM_NCHITTEST all the time.

How can I resolve this problem? Thank you.

网友答案:

I found the solution by setting the size of Win32 window to be 1 pixel (both width and height) smaller than the WPF Host Window, the issue is gone.

I think it's because both Win32 and WPF windows were sharing the same non-client area and the messages got looping.

分享给朋友:
您可能感兴趣的文章:
随机阅读: