• Hi everybody,

    I have a graphic library which is initialized with a control handle to drow on this control :

    The library needs to get some window messages related to the handle. To get this, I subclass the WNDPROC like this :
    @WNDPROC oldproc = (WNDPROC)(GetWindowLongPtr(hwnd, GWLP_WNDPROC);
    SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)newproc);@

    In newproc, I just receive this events :

    I tried to subclass the parent like this :
    @WNDPROC oldproc = (WNDPROC)(GetWindowLongPtr(GetParent(hwnd), GWLP_WNDPROC);
    SetWindowLongPtr(GetParent(hwnd), GWLP_WNDPROC, (LONG_PTR)newproc);@
    And now I have events I need, like WN_PAINT (15). Is that normal ?

    Next, when the graphLib does not handle an message, I translate it to the oldproc. It works until the message WM_DWMNCRENDERINGCHANGED (0x31F) which makes my application crash. If I redirect the message to DefWinProc, it works, but I think it's not correct.

    What can I do ? Maybe I have to compile Qt with others options ?

    Thank you all,

  • From what I see, you set the same new address window procedure for both control handle and it's parent. How do you know from what window is WM_PAINT called ? And in "newproc" commonly you must call CallWindowProc(oldproc, ...) and not DefWindowProc

  • Hi,
    I don't know what I've done, but it works without subclassing the parent :)
    Also, by calling oldproc(...) it crash but with CallWindowProc(oldproc, ...) it works :)
    So thank you very much :)

  • Moderators

    Hmmm... how does this relate to Qt at all?

  • I really don't know, I'll try it in the other computer and I'll let you know

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.