Welcome Rob.
I thought maybe what I said would be totally irrelevant since maybe you were copying all the windows to your own DirectX window or something.
I'm not sure what the mouse hitch is. For whatever it's worth, here's how I set focus in HKN. Maybe it has the same problem you're describing, I don't know. I attach to two threads because HKN might not have focus when this gets called:
Code:
DWORD set_focus ( HWND hNew )
{
DWORD dwError = 0;
HWND hCur = GetForegroundWindow();
DWORD dwOurThread = GetCurrentThreadId();
DWORD dwCurThread = GetWindowThreadProcessId ( hCur, NULL );
DWORD dwNewThread = GetWindowThreadProcessId ( hNew, NULL ); // this is the Window that will get focus
AttachThreadInput ( dwOurThread, dwCurThread, TRUE );
AttachThreadInput ( dwOurThread, dwNewThread, TRUE );
if ( NULL == SetFocus ( hNew ) ) // failure
dwError = GetLastError();
AttachThreadInput ( dwOurThread, dwCurThread, FALSE );
AttachThreadInput ( dwOurThread, dwNewThread, FALSE );
return dwError;
}
Seems like a ridiculous amount of code for something so simple, doesn't it?
If you have a better idea, please let me know.
Connect With Us