i think the host is intercepting the keystrokes and making some kind of filtering by means of hooking the messages. on another framework (win) i’ve come up with installing a hook over the host ones by scanning parent windows and installing the hooks on the windows that’s blocking’em. in some hosts you can easily install a hook over the plugin editor window,
something like:
namespace Hook
{
extern HHOOK hMsgFilterHook;
extern LRESULT CALLBACK WndFilterProc(int nCode, WPARAM wParam, LPARAM lParam);
extern BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam);
};
HHOOK Hook::hMsgFilterHook = NULL;
//_____________________________________________________________________
BOOL CALLBACK Hook::EnumChildProc(HWND hwnd, LPARAM lParam)
{
if (::GetWindowLong(hwnd, GWL_WNDPROC) == (LONG)YourClass::WndProc)
{
HWND *tmp = (HWND *)lParam;
*tmp = hwnd;
return FALSE;
}
return TRUE;
}
//_____________________________________________________________________
LRESULT CALLBACK Hook::WndFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode < HC_ACTION)
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
MSG *msg = (MSG *)lParam;
HWND focus = ::GetFocus();
HWND child = NULL;
::EnumChildWindows(focus, Hook::EnumChildProc, (LPARAM)&child);
if (child != NULL)
{
YourClass*obj = reinterpret_cast<YourClass*>(::GetWindowLong(child, GWL_USERDATA));
switch (msg->message)
{
case WM_KEYDOWN:
{
// ... do processing of events as usual
if (event.IsProcessed())
return 1;
else
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
break;
case WM_KEYUP:
{
// ... do processing of events as usual
if (event.IsProcessed())
return 1;
else
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
break;
case WM_SYSKEYDOWN:
{
// ... do processing of events as usual
if (event.IsProcessed())
return 1;
else
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
break;
case WM_SYSKEYUP:
{
// ... do processing of events as usual
if (event.IsProcessed())
return 1;
else
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
break;
default:
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
}
else
return ::CallNextHookEx(Hook::hMsgFilterHook, nCode, wParam, lParam);
}
then u can attach the hook in your window on its opening:
Hook::hMsgFilterHook = ::SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC)Hook::WndFilterProc, NULL, ::GetWindowThreadProcessId((HWND)ptr, NULL));
YourClass::m_hookInstalled = true;
and killing on close
if (YourClass::m_hookInstalled == true && m_classRefCount == 1)
::UnhookWindowsHookEx(Hook::hMsgFilterHook);
in some weird hosts you need to transverse the parent windows starting from the one the host give you, and install the hook on that window… a bunch of
[code]HWND parent = (HWND)::GetWindowLong( (HWND)ptr, GWL_HWNDPARENT );
while( parent )
{
::GetWindowText( parent, name, 256 );
if ( strcmp(name,"flswrapper") == 0)
break;
else if ( strcmp(name,"cplugin") == 0)
break;
parent = (HWND)::GetWindowLong( (HWND)parent, GWL_HWNDPARENT );
}[/code]
isn’t so easy to find out…