11-20-2017, 03:21 AM
I've done some experimenting with this. I've tried to get a handler for windows native proc for the widget and tinker a little with it so that in case of WM_PAINT default winproc is used and in all other cases old handler is used.
Now I can see the graphics, however all the callbacks related to widget like mouse down, mouse up etc are gone. Still trying to figure this out.
Code:
std::map<HWND, LONG_PTR> oldHandlerMap;
typedef LRESULT (*WndProcType)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProcTst (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_PAINT)
{
return DefWindowProc(hwnd, message, wParam, lParam) ;
}
WndProcType oldHandlerPtr = (WndProcType)oldHandlerMap[hwnd];
return CallWindowProc((WNDPROC)oldHandlerPtr, hwnd, message, wParam, lParam);
}
void RehookWinProc(const hdi::core::CustomWidget& parent) {
//return;
CWnd *pWnd = parent.platformWidget();
HWND tmpHwnd = pWnd->GetSafeHwnd();
LONG_PTR oldHandler = GetClassLongPtr(tmpHwnd, GCLP_WNDPROC);
oldHandlerMap[tmpHwnd] = oldHandler;
SetWindowLongPtr(tmpHwnd, GWLP_WNDPROC, (LONG_PTR)WndProcTst);
}
Now I can see the graphics, however all the callbacks related to widget like mouse down, mouse up etc are gone. Still trying to figure this out.