private static bool TryHookWndProc(HwndHost hwndHost)
{
if (hwndHost.Handle != IntPtr.Zero) {
// Hook the window messages so we can intercept the
// various messages.
HwndHostExtensionsWindowHook hook = new HwndHostExtensionsWindowHook(hwndHost);
// Keep our hook alive.
hwndHost.SetValue(WindowHookProperty, hook);
return true;
} else {
return false;
}
}