Skip to content

Commit

Permalink
removed unused dialog stuff, complete for version info
Browse files Browse the repository at this point in the history
  • Loading branch information
drew6017 committed Apr 10, 2020
1 parent 7470de7 commit bb52710
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 62 deletions.
16 changes: 0 additions & 16 deletions AutoRun.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions include/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 2 additions & 42 deletions src/systemtray.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,73 +25,33 @@

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:
switch (LOWORD(wParam)) {
case ID_TRAY_MENU_ABOUT:
MessageBoxA(NULL, "Created by Andrew Howard, <divisionind.com>. 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);
Expand Down

0 comments on commit bb52710

Please sign in to comment.