diff --git a/WinPowerDMS/WinPowerDMS.c b/WinPowerDMS/WinPowerDMS.c
index e13472b..52801f4 100644
--- a/WinPowerDMS/WinPowerDMS.c
+++ b/WinPowerDMS/WinPowerDMS.c
@@ -28,7 +28,7 @@ BOOL DisplayModeEquals(const DISPLAY_MODE* a, const DISPLAY_MODE* b) {
// I hate parsing the string here, but the alternative requires extra memory management.
static DISPLAY_MODE GetModeFromCB(HWND hComboBox) {
DISPLAY_MODE mode = { 0 };
- size_t selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
+ LRESULT selectedIndex = SendMessage(hComboBox, CB_GETCURSEL, 0, 0);
if (selectedIndex != CB_ERR) {
LRESULT len = SendMessage(hComboBox, CB_GETLBTEXTLEN, selectedIndex, 0);
if (len != CB_ERR) {
@@ -203,13 +203,13 @@ static DISPLAY_MODE GetCurrentDisplayMode(void) {
};
}
-static INT_PTR CALLBACK PrefsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
+static INT_PTR CALLBACK PrefsDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
HWND hComboBatt = GetDlgItem(hDlg, IDC_COMBO_BATT);
HWND hComboAC = GetDlgItem(hDlg, IDC_COMBO_AC);
HWND hCheckBattWarning = GetDlgItem(hDlg, IDC_CHECK_BATT_WARNING);
HWND hCheckStartup = GetDlgItem(hCheckBattWarning, IDC_CHECK_STARTUP);
- switch (message) {
+ switch (uMsg) {
case WM_INITDIALOG: {
// devMode object that will be enumerated
DEVMODE devMode;
@@ -217,7 +217,7 @@ static INT_PTR CALLBACK PrefsDialogProc(HWND hDlg, UINT message, WPARAM wParam,
devMode.dmSize = sizeof(devMode);
size_t modeCount = 0;
- int modeNum = 0;
+ DWORD modeNum = 0;
DISPLAY_MODE lastMode = { 0 };
while (EnumDisplaySettings(NULL, modeNum++, &devMode)) {
DISPLAY_MODE currentMode = {
@@ -372,12 +372,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
AppendMenu(hMenu, MF_STRING, ID_TRAY_EXIT, L"Exit");
// Setup tray icon
+ HICON hTrayIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON));
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = TRAY_ICON_ID;
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
nid.uCallbackMessage = WM_TRAYICON;
- nid.hIcon = LoadIcon(NULL, IDI_APPLICATION); // Replace this with my own icon at some point
+ nid.hIcon = hTrayIcon;
wcscpy_s(nid.szTip, sizeof(nid.szTip) / sizeof(nid.szTip[0]), L"WinPowerDMS");
Shell_NotifyIcon(NIM_ADD, &nid);
@@ -389,5 +390,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
DispatchMessage(&msg);
}
+ DestroyIcon(hTrayIcon);
return 0;
}
\ No newline at end of file
diff --git a/WinPowerDMS/WinPowerDMS.ico b/WinPowerDMS/WinPowerDMS.ico
new file mode 100644
index 0000000..224650f
Binary files /dev/null and b/WinPowerDMS/WinPowerDMS.ico differ
diff --git a/WinPowerDMS/WinPowerDMS.rc b/WinPowerDMS/WinPowerDMS.rc
index 7eb1a13..4998504 100644
Binary files a/WinPowerDMS/WinPowerDMS.rc and b/WinPowerDMS/WinPowerDMS.rc differ
diff --git a/WinPowerDMS/WinPowerDMS.vcxproj b/WinPowerDMS/WinPowerDMS.vcxproj
index e9c8385..6795c1e 100644
--- a/WinPowerDMS/WinPowerDMS.vcxproj
+++ b/WinPowerDMS/WinPowerDMS.vcxproj
@@ -136,6 +136,9 @@
+
+
+
diff --git a/WinPowerDMS/WinPowerDMS.vcxproj.filters b/WinPowerDMS/WinPowerDMS.vcxproj.filters
index 7040bfa..9235a1c 100644
--- a/WinPowerDMS/WinPowerDMS.vcxproj.filters
+++ b/WinPowerDMS/WinPowerDMS.vcxproj.filters
@@ -15,7 +15,7 @@
-
+
Source Files
@@ -29,4 +29,9 @@
Resource Files
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/WinPowerDMS/resource.h b/WinPowerDMS/resource.h
index 8fbc1eb..af56e51 100644
--- a/WinPowerDMS/resource.h
+++ b/WinPowerDMS/resource.h
@@ -3,6 +3,7 @@
// Used by WinPowerDMS.rc
//
#define IDD_PREFSDIALOG 101
+#define IDI_APPICON 106
#define IDC_COMBO_BATT 1001
#define IDC_COMBO_AC 1002
#define IDC_BUTTON_TEST_BATT 1003
@@ -16,7 +17,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 104
+#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_SYMED_VALUE 101