-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationMonitor.h
More file actions
51 lines (47 loc) · 1.73 KB
/
ApplicationMonitor.h
File metadata and controls
51 lines (47 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ApplicationMonitor.h
* ApplicationMonitor
*
* Constants and function declarations for ApplicationMonitor.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <map>
#include <string>
#include <windows.h>
#include <tchar.h>
#include "lsapi.h"
#include <strsafe.h>
#include <tlhelp32.h>
// Constants
LPCTSTR g_rcsRevision = _T("0.2");
LPCTSTR g_szAppName = _T("ApplicationMonitor");
LPCTSTR g_szMsgHandler = _T("LSApplicationMonitorManager");
const UINT g_lsMessages[] = { LM_GETREVID, LM_REFRESH, 0 };
// Typedefs
typedef struct MonitorData
{
TCHAR szName[MAX_RCCOMMAND];
TCHAR szApplication[MAX_PATH];
UINT iUpdateFrequency;
bool bIsRunning;
TCHAR szOnEnd[MAX_LINE_LENGTH];
TCHAR szOnStart[MAX_LINE_LENGTH];
} MonitorData;
typedef std::map<UINT, MonitorData> MonitorMap;
// Global Variables
HWND g_hParent, g_hwndMessageHandler;
HINSTANCE g_hInstance;
TCHAR g_szPath[MAX_PATH];
MonitorMap g_MonitorMap;
// Function declarations
extern "C" __declspec( dllexport ) int initModuleW(HWND hwndParent, HINSTANCE hDllInstance, LPCWSTR pszPath);
extern "C" __declspec( dllexport ) void quitModule(HINSTANCE hDllInstance);
LRESULT WINAPI MessageHandlerProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
bool CreateMessageHandler();
void LoadConfig();
void ParseConfigLine(LPCTSTR pszLine);
void Check(UINT id, bool bInitialize = false);
bool AppIsRunning(LPCTSTR pszApp);
void SetEvar(LPCTSTR pszGroup, LPCTSTR pszEvar, LPCTSTR pszFormat, ...);
void GetPrefixedRCLine(LPTSTR pszDest, LPCTSTR pszPrefix, LPCTSTR pszOption, LPCTSTR pszDefault);
void BangApplicationMonitor(HWND, LPCTSTR pszArgs);