ocedure SetForegroundWindow(hWnd) Protected foregroundThreadID, ourThreadID If GetWindowLong_(hWnd, #GWL_STYLE) & #WS_MINIMIZE ShowWindow_(hWnd, #SW_MAXIMIZE) UpdateWindow_(hWnd) EndIf foregroundThreadID = GetWindowThreadProcessId_(GetForegroundWindow_(), 0) ourThreadID = GetCurrentThreadId_() If (foregroundThreadID <> ourThreadID) AttachThreadInput_(foregroundThreadID, ourThreadID, #True); EndIf SetForegroundWindow_(hWnd) If (foregroundThreadID <> ourThreadID) AttachThreadInput_(foregroundThreadID, ourThreadID, #False) EndIf InvalidateRect_(hWnd, #Null, #True) EndProcedure hWnd = FindWindowEx_(0, 0, "CLASS", "TITLE") If hWnd SetForegroundWindow(hWnd