BatteryMonitor
/media/development/cpp/BatteryMonitor/main.h
Go to the documentation of this file.
1 
8 #ifndef _MAIN_H
9 #define _MAIN_H
10 
11 
14 #define WINVER 0x0501
15 
19 #define _WIN32_IE 0x600
20 #include <initguid.h>
21 #include <stdlib.h>
22 #include <windows.h>
23 #include <winuser.h>
24 #include <stdio.h>
25 #include <setupapi.h>
26 #include <ddk/batclass.h>
27 #include "mainres.h"
28 
31 namespace BatteryMonitor{
32 
38 LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
39 
46 void addNotifyIcon(HWND hwnd);
47 
53 void errOut(void);
54 
57 void showBatteryInfo(HWND hwnd);
58 
64 void shutdown(void);
65 
71 void initDevice(void);
72 
81 HWND setupWindow(int nCmdShow);
82 
87 long setupWindowClass(void);
88 
93 void cleanUp(HWND hwnd);
94 
102 BATTERY_INFORMATION getBatteryInformation() ;
103 
104 
107 #define UPDATE_BATTERY 1
108 
116 
130 
134 HINSTANCE instance;
135 
142 double battery=0;
143 
149 
154 char classname[14];
155 
163 
166 bool shutdown_enabled=false;
167 
168 }
169 #endif /* _MAIN_H */
170 
UINT WM_TASKBARCREATED
Window message for taskbarcreated-event.
Definition: main.h:162
BATTERY_INFORMATION getBatteryInformation()
retrieves battery informations from the system.
Definition: main.cpp:328
void cleanUp(HWND hwnd)
Memory and handler cleanups, taskbar icon removal.
Definition: main.cpp:92
Root namespace.
Definition: main.cpp:65
HBRUSH yellow
Yellow brush.
Definition: main.h:129
void initDevice()
Retrieves the path of the battery device.
Definition: main.cpp:301
void addNotifyIcon(HWND hwnd)
Adds an icon to the taskbar.
Definition: main.cpp:234
void errOut()
Error output.
Definition: main.cpp:123
HBRUSH blue
Blue brush.
Definition: main.h:129
HBRUSH green
Green brush.
Definition: main.h:129
double battery
Battery charge.
Definition: main.h:142
bool shutdown_enabled
Indicates, if shutdown was invoked by BatteryMonitor.
Definition: main.h:166
long batterylifetime
Remaining battery lifetime in seconds.
Definition: main.h:148
HINSTANCE instance
Application instance.
Definition: main.h:134
Resources of BatteryMonitor.
char * devicepath
Path to battery device.
Definition: main.h:115
void showBatteryInfo(HWND hwnd)
Shows a balloon tip with battery information.
Definition: main.cpp:249
long setupWindowClass()
registers the window class stored in classname.
Definition: main.cpp:105
HWND setupWindow(int nCmdShow)
Shows the main window.
Definition: main.cpp:66
LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
The window procedure.
Definition: main.cpp:133
char classname[14]
Name of registered window class.
Definition: main.h:154
void shutdown()
Tries to shut down the computer.
Definition: main.cpp:273
HBRUSH red
Red brush.
Definition: main.h:129