2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "WindowHelper.h"
13 CWHelper g_windowHelper
;
15 CWHelper::CWHelper(void) : CThread("WindowHelper")
21 CWHelper::~CWHelper(void)
25 if(m_hProcess
!= NULL
)
27 CloseHandle(m_hProcess
);
32 void CWHelper::OnStartup()
34 if((m_hwnd
== NULL
) && (m_hProcess
== NULL
))
37 // Minimize XBMC if not already
38 ShowWindow(g_hWnd
,SW_MINIMIZE
);
40 ShowWindow(m_hwnd
,SW_RESTORE
);
42 OutputDebugString(L
"WindowHelper thread started\n");
45 void CWHelper::OnExit()
47 // Bring back XBMC window
48 ShowWindow(g_hWnd
,SW_RESTORE
);
49 SetForegroundWindow(g_hWnd
);
51 if(m_hProcess
!= NULL
)
53 CloseHandle(m_hProcess
);
56 LockSetForegroundWindow(LSFW_LOCK
);
57 OutputDebugString(L
"WindowHelper thread ended\n");
60 void CWHelper::Process()
64 if(WaitForSingleObject(m_hProcess
,500) != WAIT_TIMEOUT
)
66 /*if((m_hwnd != NULL) && (IsIconic(m_hwnd) == TRUE))
71 void CWHelper::SetHWND(HWND hwnd
)
76 void CWHelper::SetHANDLE(HANDLE hProcess
)
78 m_hProcess
= hProcess
;