void WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
{
// if we got the EVENT_SYSTEM_FOREGROUND, and the hwnd is the putty terminal hwnd (m_AppWin)
// then bring the supperputty window to the foreground
bool isThis = (hwnd == ChildHandle);
if (eventType == EVENT_SYSTEM_FOREGROUND)
{
HasFocus = (GetForegroundWindow() == ChildHandle);
}
else if (isThis && eventType == EVENT_OBJECT_NAMECHANGE)
{
SetCaptionFromTerminal();
}
}