[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / platform / win32 / WindowHelper.cpp
blob517e001b1e71249e541ea7427002e6f7764cf645
1 /*
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.
7 */
9 #include "WindowHelper.h"
11 extern HWND g_hWnd;
13 CWHelper g_windowHelper;
15 CWHelper::CWHelper(void) : CThread("WindowHelper")
17 m_hwnd = NULL;
18 m_hProcess = NULL;
21 CWHelper::~CWHelper(void)
23 StopThread();
24 m_hwnd = NULL;
25 if(m_hProcess != NULL)
27 CloseHandle(m_hProcess);
28 m_hProcess = NULL;
32 void CWHelper::OnStartup()
34 if((m_hwnd == NULL) && (m_hProcess == NULL))
35 return;
37 // Minimize XBMC if not already
38 ShowWindow(g_hWnd,SW_MINIMIZE);
39 if(m_hwnd != NULL)
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);
50 m_hwnd = NULL;
51 if(m_hProcess != NULL)
53 CloseHandle(m_hProcess);
54 m_hProcess = NULL;
56 LockSetForegroundWindow(LSFW_LOCK);
57 OutputDebugString(L"WindowHelper thread ended\n");
60 void CWHelper::Process()
62 while (( !m_bStop ))
64 if(WaitForSingleObject(m_hProcess,500) != WAIT_TIMEOUT)
65 break;
66 /*if((m_hwnd != NULL) && (IsIconic(m_hwnd) == TRUE))
67 break;*/
71 void CWHelper::SetHWND(HWND hwnd)
73 m_hwnd = hwnd;
76 void CWHelper::SetHANDLE(HANDLE hProcess)
78 m_hProcess = hProcess;