Skip to content

Commit

Permalink
Change custom message WM_TRAYMESSAGE to APPM_TRAYMESSAGE, WM_CHANGENO…
Browse files Browse the repository at this point in the history
…TIFY to APPM_CHANGENOTIFY.
  • Loading branch information
zufuliu committed Sep 17, 2017
1 parent 810ed9c commit cffabe8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
}
break;

case WM_TRAYMESSAGE:
case APPM_TRAYMESSAGE:
switch (lParam) {
case WM_RBUTTONUP: {

Expand Down Expand Up @@ -3225,8 +3225,8 @@ BOOL ActivatePrevInst(void) {
}

if (!IsWindowVisible(hwnd)) {
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONUP);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONUP);
}

SetForegroundWindow(hwnd);
Expand Down Expand Up @@ -3354,7 +3354,7 @@ void ShowNotifyIcon(HWND hwnd, BOOL bAdd) {
nid.hWnd = hwnd;
nid.uID = 0;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_TRAYMESSAGE;
nid.uCallbackMessage = APPM_TRAYMESSAGE;
nid.hIcon = hIcon;
lstrcpy(nid.szTip, L"metapath");

Expand Down
2 changes: 1 addition & 1 deletion metapath/src/metapath.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#define ID_TIMER 0xA000

//==== Callback Message from System Tray ======================================
#define WM_TRAYMESSAGE WM_USER
#define APPM_TRAYMESSAGE (WM_APP + 4)

//==== Function Declarations ==================================================
BOOL InitApplication(HINSTANCE hInstance);
Expand Down
26 changes: 13 additions & 13 deletions src/Notepad2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
UpdateStatusbar();

//if (bPendingChangeNotify)
// PostMessage(hwnd, WM_CHANGENOTIFY, 0, 0);
// PostMessage(hwnd, APPM_CHANGENOTIFY, 0, 0);
break;

case WM_DROPFILES: {
Expand Down Expand Up @@ -1248,7 +1248,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
}
return DefWindowProc(hwnd, umsg, wParam, lParam);

case WM_CHANGENOTIFY:
case APPM_CHANGENOTIFY:
if (iFileWatchingMode == 1 || bModified || iEncoding != iOriginalEncoding) {
SetForegroundWindow(hwnd);
}
Expand Down Expand Up @@ -1296,7 +1296,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;

//// This message is posted before Notepad2 reactivates itself
//case WM_CHANGENOTIFYCLEAR:
//case APPM_CHANGENOTIFYCLEAR:
// bPendingChangeNotify = FALSE;
// break;

Expand All @@ -1320,7 +1320,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
}
break;

case WM_TRAYMESSAGE:
case APPM_TRAYMESSAGE:
switch (lParam) {
case WM_RBUTTONUP: {
HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_POPUPMENU));
Expand Down Expand Up @@ -7182,15 +7182,15 @@ BOOL ActivatePrevInst(void) {
DWORD cb = sizeof(NP2PARAMS);

// Make sure the previous window won't pop up a change notification message
//SendMessage(hwnd, WM_CHANGENOTIFYCLEAR, 0, 0);
//SendMessage(hwnd, APPM_CHANGENOTIFYCLEAR, 0, 0);

if (IsIconic(hwnd)) {
ShowWindowAsync(hwnd, SW_RESTORE);
}

if (!IsWindowVisible(hwnd)) {
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONUP);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONUP);
}

SetForegroundWindow(hwnd);
Expand Down Expand Up @@ -7249,15 +7249,15 @@ BOOL ActivatePrevInst(void) {
// Enabled
if (IsWindowEnabled(hwnd)) {
// Make sure the previous window won't pop up a change notification message
//SendMessage(hwnd, WM_CHANGENOTIFYCLEAR, 0, 0);
//SendMessage(hwnd, APPM_CHANGENOTIFYCLEAR, 0, 0);

if (IsIconic(hwnd)) {
ShowWindowAsync(hwnd, SW_RESTORE);
}

if (!IsWindowVisible(hwnd)) {
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, WM_TRAYMESSAGE, 0, WM_LBUTTONUP);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONDBLCLK);
SendMessage(hwnd, APPM_TRAYMESSAGE, 0, WM_LBUTTONUP);
}

SetForegroundWindow(hwnd);
Expand Down Expand Up @@ -7649,7 +7649,7 @@ void ShowNotifyIcon(HWND hwnd, BOOL bAdd) {
nid.hWnd = hwnd;
nid.uID = 0;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_TRAYMESSAGE;
nid.uCallbackMessage = APPM_TRAYMESSAGE;
nid.hIcon = hIcon;
lstrcpy(nid.szTip, L"Notepad2");

Expand Down Expand Up @@ -7773,7 +7773,7 @@ void CALLBACK WatchTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTim
KillTimer(NULL, ID_WATCHTIMER);
bRunningWatch = FALSE;
dwChangeNotifyTime = 0;
SendMessage(hwndMain, WM_CHANGENOTIFY, 0, 0);
SendMessage(hwndMain, APPM_CHANGENOTIFY, 0, 0);
}

// Check Change Notification Handle
Expand Down Expand Up @@ -7803,7 +7803,7 @@ void CALLBACK WatchTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTim
KillTimer(NULL, ID_WATCHTIMER);
bRunningWatch = FALSE;
dwChangeNotifyTime = 0;
SendMessage(hwndMain, WM_CHANGENOTIFY, 0, 0);
SendMessage(hwndMain, APPM_CHANGENOTIFY, 0, 0);
}
} else {
FindNextChangeNotification(hChangeHandle);
Expand Down
6 changes: 3 additions & 3 deletions src/Notepad2.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ typedef struct np2params {

//==== Change Notifications ===================================================
#define ID_WATCHTIMER 0xA000
#define WM_CHANGENOTIFY WM_USER+1
//#define WM_CHANGENOTIFYCLEAR WM_USER+2
#define APPM_CHANGENOTIFY (WM_APP + 2)
//#define APPM_CHANGENOTIFYCLEAR (WM_APP + 3)

//==== Callback Message from System Tray ======================================
#define WM_TRAYMESSAGE WM_USER
#define APPM_TRAYMESSAGE (WM_APP + 4)

//==== Paste Board Timer ======================================================
#define ID_PASTEBOARDTIMER 0xA001
Expand Down

0 comments on commit cffabe8

Please sign in to comment.