2010-03-20 19:40:30 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2010 spx
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RAINMETER_SYSTEM_H__
|
|
|
|
#define __RAINMETER_SYSTEM_H__
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <vector>
|
|
|
|
|
2010-09-11 19:39:45 +00:00
|
|
|
enum OSPLATFORM
|
|
|
|
{
|
|
|
|
OSPLATFORM_UNKNOWN = 0,
|
|
|
|
OSPLATFORM_9X,
|
|
|
|
OSPLATFORM_NT4,
|
|
|
|
OSPLATFORM_2K,
|
|
|
|
OSPLATFORM_XP,
|
|
|
|
OSPLATFORM_VISTA,
|
|
|
|
OSPLATFORM_7
|
|
|
|
};
|
|
|
|
|
2010-03-20 19:40:30 +00:00
|
|
|
struct MONITOR_INFO
|
|
|
|
{
|
|
|
|
bool active;
|
|
|
|
HMONITOR handle;
|
|
|
|
RECT screen;
|
|
|
|
RECT work;
|
|
|
|
WCHAR deviceName[32]; //Device name (E.g. "\\.\DISPLAY1")
|
|
|
|
WCHAR monitorName[128]; //Monitor name (E.g. "Generic Non-PnP Monitor")
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MULTIMONITOR_INFO
|
|
|
|
{
|
|
|
|
bool useEnumDisplayDevices; //If true, use EnumDisplayDevices function to obtain the multi-monitor information
|
|
|
|
bool useEnumDisplayMonitors; //If true, use EnumDisplayMonitors function to obtain the multi-monitor information
|
|
|
|
|
|
|
|
int vsT, vsL, vsH, vsW; //Coordinates of the top-left corner (vsT,vsL) and size (vsH,vsW) of the virtual screen
|
|
|
|
int primary; //Index of the primary monitor
|
|
|
|
std::vector<MONITOR_INFO> monitors; //Monitor information
|
|
|
|
};
|
|
|
|
|
|
|
|
class CSystem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void Initialize(HINSTANCE instance);
|
|
|
|
static void Finalize();
|
|
|
|
|
2010-07-17 13:02:34 +00:00
|
|
|
static HWND GetWindow() { return c_Window; }
|
|
|
|
|
2010-03-20 19:40:30 +00:00
|
|
|
static const MULTIMONITOR_INFO& GetMultiMonitorInfo() { return c_Monitors; }
|
|
|
|
static size_t GetMonitorCount();
|
|
|
|
|
|
|
|
static bool GetShowDesktop() { return c_ShowDesktop; }
|
|
|
|
|
2010-03-29 21:50:05 +00:00
|
|
|
static HWND GetHelperWindow() { return c_HelperWindow; }
|
2011-08-13 10:03:16 +00:00
|
|
|
static void PrepareHelperWindow(HWND WorkerW = GetWorkerW());
|
2010-03-20 19:40:30 +00:00
|
|
|
|
2010-09-11 19:39:45 +00:00
|
|
|
static OSPLATFORM GetOSPlatform();
|
2011-06-05 12:32:18 +00:00
|
|
|
static ULONGLONG GetTickCount64();
|
2010-09-11 19:39:45 +00:00
|
|
|
|
|
|
|
static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = NULL, bool ignoreErrors = false);
|
2011-05-23 20:21:19 +00:00
|
|
|
static void ResetWorkingDirectory();
|
2011-05-22 16:02:43 +00:00
|
|
|
|
2010-08-03 15:10:42 +00:00
|
|
|
static bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMove = false);
|
|
|
|
static bool RemoveFile(const std::wstring& file);
|
|
|
|
|
|
|
|
static void GetIniFileMappingList(std::vector<std::wstring>& iniFileMappings);
|
|
|
|
static std::wstring GetTemporaryFile(const std::vector<std::wstring>& iniFileMappings, const std::wstring& iniFile);
|
|
|
|
|
2010-03-20 19:40:30 +00:00
|
|
|
private:
|
2010-03-29 21:50:05 +00:00
|
|
|
static void CALLBACK MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
|
2010-03-20 19:40:30 +00:00
|
|
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static BOOL DwmIsCompositionEnabled();
|
|
|
|
|
|
|
|
static void SetMultiMonitorInfo();
|
|
|
|
static void ClearMultiMonitorInfo() { c_Monitors.monitors.clear(); }
|
|
|
|
static void UpdateWorkareaInfo();
|
|
|
|
|
2010-03-29 21:50:05 +00:00
|
|
|
static HWND GetDefaultShellWindow();
|
2011-08-13 10:03:16 +00:00
|
|
|
static HWND GetWorkerW();
|
2010-03-20 19:40:30 +00:00
|
|
|
static void ChangeZPosInOrder();
|
|
|
|
|
2011-06-23 13:29:51 +00:00
|
|
|
static bool CheckDesktopState(HWND WorkerW);
|
2010-03-29 21:50:05 +00:00
|
|
|
static bool BelongToSameProcess(HWND hwndA, HWND hwndB);
|
|
|
|
|
2010-03-20 19:40:30 +00:00
|
|
|
static HWND c_Window;
|
2010-03-29 21:50:05 +00:00
|
|
|
static HWND c_HelperWindow;
|
|
|
|
|
|
|
|
static HWINEVENTHOOK c_WinEventHook;
|
2010-03-20 19:40:30 +00:00
|
|
|
|
|
|
|
static MULTIMONITOR_INFO c_Monitors; // Multi-Monitor info
|
|
|
|
|
|
|
|
static bool c_ShowDesktop;
|
2010-09-11 19:39:45 +00:00
|
|
|
|
|
|
|
static OSPLATFORM c_Platform;
|
2011-05-22 16:02:43 +00:00
|
|
|
|
|
|
|
static std::wstring c_WorkingDirectory;
|
2010-03-20 19:40:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|