diff --git a/AutoRun.rc b/AutoRun.rc index c3c735e..3865a96 100644 --- a/AutoRun.rc +++ b/AutoRun.rc @@ -5,7 +5,6 @@ #define AUTORUN_VERSION_WIN_ST AUTORUN_VERSION_ST ".0" IDI_MYICON ICON "autorun-logo.ico" -//IDB_LOGO_BITMAP BITMAP "autorun-logo-128x.bmp" IDR_TRAY_MENU MENU BEGIN @@ -17,21 +16,6 @@ BEGIN END END -ID_DIALOG_TEST DIALOGEX 0, 0, 259, 145 -STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About" -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -FONT 8, "MS Shell Dlg", 400, 0, 1 -BEGIN - CONTROL "AutoRun", 1001, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 10, 13, 118, 24 - CONTROL AUTORUN_VERSION_ST, 1002, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 36, 91, 20 - //CONTROL IDB_LOGO_BITMAP, 1063, STATIC, SS_BITMAP | WS_CHILD | WS_VISIBLE, 163, 6, 85, 79 - CONTROL "Copyright \xA9 2020 Division Industries LLC. GNU GPL v3.0.", 1003, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 96, 237, 13 - CONTROL "https://divisionind.com/", 1004, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 110, 237, 10 - CONTROL "https://github.com/divisionind/AutoRun/", 1005, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 11, 124, 149, 12 - CONTROL "OK", 1, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 202, 124, 50, 14 -END - 1 VERSIONINFO FILEVERSION AUTORUN_VERSION_WIN PRODUCTVERSION AUTORUN_VERSION_WIN diff --git a/CMakeLists.txt b/CMakeLists.txt index 00a26b7..ec7dfa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(AutoRun) # version info for building set(V1 2020) set(V2 1) -set(V3 3) +set(V3 4) set(CMAKE_CXX_STANDARD 14) diff --git a/include/resource.h b/include/resource.h index 1577133..4e8e582 100644 --- a/include/resource.h +++ b/include/resource.h @@ -20,12 +20,9 @@ #define AUTORUN_RESOURCE_H #define IDI_MYICON 101 -//#define IDB_LOGO_BITMAP 110 #define IDR_TRAY_MENU 200 #define ID_TRAY_MENU_EXIT 201 #define ID_TRAY_MENU_ABOUT 202 -#define ID_DIALOG_TEST 300 - #endif //AUTORUN_RESOURCE_H diff --git a/src/systemtray.c b/src/systemtray.c index 016a03d..59fdb52 100644 --- a/src/systemtray.c +++ b/src/systemtray.c @@ -25,65 +25,26 @@ const char szClassName[] = "GenericTrayCallback"; -BOOL CALLBACK DialogProcInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) { - case WM_COMMAND: - switch (LOWORD(wParam)) { - case 1: - EndDialog(hwnd, wParam); - return TRUE; - } - break; - case WM_INITDIALOG: - RECT desktop; - GetWindowRect(GetDesktopWindow(), &desktop); - int horiz = desktop.right; - int vert = desktop.bottom; - - RECT dialog; - GetWindowRect(hwnd, &dialog); - SetWindowPos(hwnd, NULL, (horiz/2) - (dialog.right/2), (vert/2) - (dialog.bottom/2), 0, 0, SWP_NOSIZE | SWP_NOZORDER); - default: ; - } - - return FALSE; -} - LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case TRAY_CALLBACK_MSG: switch (lParam) { + default: + break; case WM_LBUTTONUP: case WM_RBUTTONUP: HMENU hMenu, hMenuContainer; hMenuContainer = LoadMenuA(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_TRAY_MENU)); hMenu = GetSubMenu(hMenuContainer, 0); - // I ended up deciding to use resources -// hMenu = CreatePopupMenu(); -// AppendMenuA(hMenu, MF_STRING, MENU_ID_TEST1, "Test1"); -// AppendMenuA(hMenu, MF_SEPARATOR, 0, NULL); -// AppendMenuA(hMenu, MF_STRING, MENU_ID_EXIT, "Exit"); POINT cursorLoc; GetCursorPos(&cursorLoc); -// HBRUSH color = CreateSolidBrush(RGB(255, 0, 0)); -// MENUINFO menuInfo; -// memset(&menuInfo, 0, sizeof(MENUINFO)); -// menuInfo.cbSize = sizeof(MENUINFO); -// menuInfo.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS; -// menuInfo.hbrBack = color; -// SetMenuInfo(hMenu, &menuInfo); - SetForegroundWindow(hwnd); // needed to make the menu automatically close when it looses focus TrackPopupMenu(hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, cursorLoc.x, cursorLoc.y, 0, hwnd, NULL); SendMessage(hwnd, WM_NULL, 0, 0); DestroyMenu(hMenu); DestroyMenu(hMenuContainer); -// DeleteObject(color); - break; - default: - break; } break; case WM_COMMAND: @@ -91,7 +52,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { case ID_TRAY_MENU_ABOUT: MessageBoxA(NULL, "Created by Andrew Howard, . View the github " "at https://github.com/divisionind/AutoRun for more info.", "AutoRun v" AUTORUN_VERSION_ST, MB_OK | MB_ICONINFORMATION); -// DialogBox(NULL, MAKEINTRESOURCE(ID_DIALOG_TEST), NULL, DialogProcInfo); break; case ID_TRAY_MENU_EXIT: PostQuitMessage(0);