Richink subclassing problem


Hello,
I'm having problems subclassing the richink window. After creating the WC_INKX window I'm able to get a handle to the richink window with the "IM_GETRICHINK" message, then I set my custom wndproc on the richink window, and I store on a global variable a handle to the old window proc. The custom window proc gets called, but even if I don't handle any message and I just call the old wndproc passing the values to it, the rich ink window doesn't even display (as if some of the WM_PAINT messages wouldnt get handled).
Here are the relevant code lines I'm using:

//create the main richink window
HWND rhwnd = CreateWindow (WC_INKX, NULL, dwStyle, rect.left-28 rect.top-10, rect.right-28,rect.bottom-10,this->GetSafeHwnd(),0,AfxGetInstanceHandle(),NULL);

//get a handle to the inner rich ink window
richInk = (HWND)::SendMessage(rhwnd, IM_GETRICHINK, 0, 0);

//set custom prov to handle messages
oldProc = (WNDPROC)SetWindowLong(richInk,GWL_WNDPROC,(LONG)MyWndProc);

The custom proc is the following:

LRESULT MyWndProc(UINT message, WPARAM wParam,
LPARAM lParam)
{
printf("Called with message = 0x%x\n", message);
return CallWindowProc(oldProc, richInk, message, wParam, lParam);
}

Of course if I don't subclass the richink window (if I comment out the SetWindowLong line)
the window gets display correctly and I can use the richink control.
I need to subclass the richink window in order to make the control read-only and for a few other purposes.

Any help is greatly appraciated :)



Answer this question

Richink subclassing problem