I add a hook to the window to make possible using of WndProc:
void ManagedEngine::OnSourceInitialized(System::Object ^sender, System::EventArgs ^e)
{
HwndSource^ hwndSource = (HwndSource^)HwndSource::FromVisual((Window^)sender);
hwndSource->AddHook(gcnew HwndSourceHook(WinDowProc));
}
IntPtr ManagedEngine::WinDowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, bool% handeled)
{
//Console::WriteLine(String::Format("????? ? ???? ????????? ??????? ????????? {0}", msg));
//Keyboard::instance().handleMsg((HWND)hwnd.ToPointer(), msg, (WPARAM)wParam.ToPointer(), (LPARAM)lParam.ToPointer());
/*return (IntPtr)DefWindowProc((HWND)hwnd.ToPointer(), msg, (WPARAM)wParam.ToPointer(), (LPARAM)lParam.ToPointer());*/
switch (msg)
{
case WM_ERASEBKGND:
return (IntPtr)1;
}
return IntPtr::Zero;
}
SetClassLongPtr seems to do nothing with parameters you wrote:
SetClassLongPtr(WPFHwnd, -10, NULL);
SetWIndowLongPtr with these parameters lead to appear completely white window, which cannot be even clicked:
SetWindowLongPtr(WPFHwnd, -16, NULL);
Could you please give me the cue how to make with little "hook" correctly?
P.S. adding transparency make the window completely invisible, so I cannot see it at all. This is not that I want to achieve.