Skip to content

Commit b1cd6ed

Browse files
committed
Changes in coding style (formatted files).
1 parent 19b1fa0 commit b1cd6ed

30 files changed

+1450
-1450
lines changed

MenuCommon/Defines.h

+59-59
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
#pragma once
2-
3-
// Debug
4-
#define MT_DEBUG_ONLY_X86 FALSE
5-
#define MT_DEBUG_ONLY_X64 FALSE
6-
7-
// 64 bits
8-
#ifdef _WIN64
9-
#define BUILD(x) x ## 64
10-
11-
// 32 bits
12-
#elif _WIN32
13-
#define BUILD(x) x
14-
#endif
15-
16-
// Strings
17-
#define MT_DLL_NAME _T("MenuToolsHook.dll")
18-
#define MT_DLL_NAME64 _T("MenuToolsHook64.dll")
19-
#define MT_EXE_NAME _T("MenuTools.exe")
20-
#define MT_EXE_NAME64 _T("MenuTools64.exe")
21-
#define MT_JOB_NAME _T("MenuToolsJob")
22-
23-
// Hook
24-
#define MT_HOOK_PROC_CWP "CallWndProc"
25-
#define MT_HOOK_PROC_GMP "GetMsgProc"
26-
27-
// Hook -> Messages
28-
#define MT_HOOK_MSG_QUIT RegisterWindowMessage(_T("MenuToolsQuit"))
29-
#define MT_HOOK_MSG_TRAY WM_USER + 0x210
30-
31-
// Menu
32-
#define MT_MENU_PRIORITY WM_USER + 0x2100
33-
#define MT_MENU_TRANSPARENCY WM_USER + 0x2200
34-
#define MT_MENU_ALWAYS_ON_TOP WM_USER + 0x2010
35-
#define MT_MENU_MINIMIZE_TO_TRAY WM_USER + 0x2020
36-
#define MT_MENU_SEPARATOR WM_USER + 0x2030
37-
38-
// Menu -> Priority
39-
#define MT_MENU_PRIORITY_REALTIME WM_USER + 0x2110
40-
#define MT_MENU_PRIORITY_HIGH WM_USER + 0x2120
41-
#define MT_MENU_PRIORITY_ABOVE_NORMAL WM_USER + 0x2130
42-
#define MT_MENU_PRIORITY_NORMAL WM_USER + 0x2140
43-
#define MT_MENU_PRIORITY_BELOW_NORMAL WM_USER + 0x2150
44-
#define MT_MENU_PRIORITY_LOW WM_USER + 0x2160
45-
46-
// Menu -> Transparency
47-
#define MT_MENU_TRANSPARENCY_0 WM_USER + 0x2210
48-
#define MT_MENU_TRANSPARENCY_10 WM_USER + 0x2220
49-
#define MT_MENU_TRANSPARENCY_20 WM_USER + 0x2230
50-
#define MT_MENU_TRANSPARENCY_30 WM_USER + 0x2240
51-
#define MT_MENU_TRANSPARENCY_40 WM_USER + 0x2250
52-
#define MT_MENU_TRANSPARENCY_50 WM_USER + 0x2260
53-
#define MT_MENU_TRANSPARENCY_60 WM_USER + 0x2270
54-
#define MT_MENU_TRANSPARENCY_70 WM_USER + 0x2280
55-
#define MT_MENU_TRANSPARENCY_80 WM_USER + 0x2290
56-
#define MT_MENU_TRANSPARENCY_90 WM_USER + 0x22A0
57-
#define MT_MENU_TRANSPARENCY_100 WM_USER + 0x22B0
58-
59-
// Tray
1+
#pragma once
2+
3+
// Debug
4+
#define MT_DEBUG_ONLY_X86 FALSE
5+
#define MT_DEBUG_ONLY_X64 FALSE
6+
7+
// 64 bits
8+
#ifdef _WIN64
9+
#define BUILD(x) x ## 64
10+
11+
// 32 bits
12+
#elif _WIN32
13+
#define BUILD(x) x
14+
#endif
15+
16+
// Strings
17+
#define MT_DLL_NAME _T("MenuToolsHook.dll")
18+
#define MT_DLL_NAME64 _T("MenuToolsHook64.dll")
19+
#define MT_EXE_NAME _T("MenuTools.exe")
20+
#define MT_EXE_NAME64 _T("MenuTools64.exe")
21+
#define MT_JOB_NAME _T("MenuToolsJob")
22+
23+
// Hook
24+
#define MT_HOOK_PROC_CWP "CallWndProc"
25+
#define MT_HOOK_PROC_GMP "GetMsgProc"
26+
27+
// Hook -> Messages
28+
#define MT_HOOK_MSG_QUIT RegisterWindowMessage(_T("MenuToolsQuit"))
29+
#define MT_HOOK_MSG_TRAY WM_USER + 0x210
30+
31+
// Menu
32+
#define MT_MENU_PRIORITY WM_USER + 0x2100
33+
#define MT_MENU_TRANSPARENCY WM_USER + 0x2200
34+
#define MT_MENU_ALWAYS_ON_TOP WM_USER + 0x2010
35+
#define MT_MENU_MINIMIZE_TO_TRAY WM_USER + 0x2020
36+
#define MT_MENU_SEPARATOR WM_USER + 0x2030
37+
38+
// Menu -> Priority
39+
#define MT_MENU_PRIORITY_REALTIME WM_USER + 0x2110
40+
#define MT_MENU_PRIORITY_HIGH WM_USER + 0x2120
41+
#define MT_MENU_PRIORITY_ABOVE_NORMAL WM_USER + 0x2130
42+
#define MT_MENU_PRIORITY_NORMAL WM_USER + 0x2140
43+
#define MT_MENU_PRIORITY_BELOW_NORMAL WM_USER + 0x2150
44+
#define MT_MENU_PRIORITY_LOW WM_USER + 0x2160
45+
46+
// Menu -> Transparency
47+
#define MT_MENU_TRANSPARENCY_0 WM_USER + 0x2210
48+
#define MT_MENU_TRANSPARENCY_10 WM_USER + 0x2220
49+
#define MT_MENU_TRANSPARENCY_20 WM_USER + 0x2230
50+
#define MT_MENU_TRANSPARENCY_30 WM_USER + 0x2240
51+
#define MT_MENU_TRANSPARENCY_40 WM_USER + 0x2250
52+
#define MT_MENU_TRANSPARENCY_50 WM_USER + 0x2260
53+
#define MT_MENU_TRANSPARENCY_60 WM_USER + 0x2270
54+
#define MT_MENU_TRANSPARENCY_70 WM_USER + 0x2280
55+
#define MT_MENU_TRANSPARENCY_80 WM_USER + 0x2290
56+
#define MT_MENU_TRANSPARENCY_90 WM_USER + 0x22A0
57+
#define MT_MENU_TRANSPARENCY_100 WM_USER + 0x22B0
58+
59+
// Tray
6060
#define MT_TRAY_MESSAGE WM_USER + 0x200

MenuCommon/Logger.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Includes
2-
#include <tchar.h>
3-
4-
// Defines
5-
#define MAX_BUFFER 1000
6-
#define LOGMESSAGE(format, ...) \
7-
{ \
8-
TCHAR buffer[MAX_BUFFER+1]; \
9-
_sntprintf_s(buffer, MAX_BUFFER, _TRUNCATE, _T(format) _T("\n"), __VA_ARGS__); \
10-
OutputDebugString(buffer); \
11-
}
1+
// Includes
2+
#include <tchar.h>
3+
4+
// Defines
5+
#define MAX_BUFFER 1000
6+
#define LOGMESSAGE(format, ...) \
7+
{ \
8+
TCHAR buffer[MAX_BUFFER+1]; \
9+
_sntprintf_s(buffer, MAX_BUFFER, _TRUNCATE, _T(format) _T("\n"), __VA_ARGS__); \
10+
OutputDebugString(buffer); \
11+
}

MenuCommon/MenuCommon.vcxproj.filters

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<ItemGroup>
4-
<Filter Include="Source Files">
5-
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6-
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7-
</Filter>
8-
<Filter Include="Header Files">
9-
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10-
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11-
</Filter>
12-
<Filter Include="Resource Files">
13-
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14-
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15-
</Filter>
16-
</ItemGroup>
17-
<ItemGroup>
18-
<ClInclude Include="stdafx.h">
19-
<Filter>Header Files</Filter>
20-
</ClInclude>
21-
<ClInclude Include="targetver.h">
22-
<Filter>Header Files</Filter>
23-
</ClInclude>
24-
<ClInclude Include="Defines.h">
25-
<Filter>Header Files</Filter>
26-
</ClInclude>
27-
<ClInclude Include="Logger.h">
28-
<Filter>Header Files</Filter>
29-
</ClInclude>
30-
<ClInclude Include="TrayIcon.h">
31-
<Filter>Header Files</Filter>
32-
</ClInclude>
33-
</ItemGroup>
34-
<ItemGroup>
35-
<ClCompile Include="stdafx.cpp">
36-
<Filter>Source Files</Filter>
37-
</ClCompile>
38-
<ClCompile Include="TrayIcon.cpp">
39-
<Filter>Source Files</Filter>
40-
</ClCompile>
41-
</ItemGroup>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClInclude Include="stdafx.h">
19+
<Filter>Header Files</Filter>
20+
</ClInclude>
21+
<ClInclude Include="targetver.h">
22+
<Filter>Header Files</Filter>
23+
</ClInclude>
24+
<ClInclude Include="Defines.h">
25+
<Filter>Header Files</Filter>
26+
</ClInclude>
27+
<ClInclude Include="Logger.h">
28+
<Filter>Header Files</Filter>
29+
</ClInclude>
30+
<ClInclude Include="TrayIcon.h">
31+
<Filter>Header Files</Filter>
32+
</ClInclude>
33+
</ItemGroup>
34+
<ItemGroup>
35+
<ClCompile Include="stdafx.cpp">
36+
<Filter>Source Files</Filter>
37+
</ClCompile>
38+
<ClCompile Include="TrayIcon.cpp">
39+
<Filter>Source Files</Filter>
40+
</ClCompile>
41+
</ItemGroup>
4242
</Project>

MenuCommon/TrayIcon.cpp

+73-73
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
1-
#include "stdafx.h"
2-
#include "TrayIcon.h"
3-
4-
Tray_Map mTrays;
5-
UINT TrayIcon::uId = 0;
6-
7-
TrayIcon::TrayIcon(HWND hWnd)
8-
{
9-
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
10-
11-
nid.cbSize = sizeof(NOTIFYICONDATA);
12-
nid.hWnd = hWnd;
13-
nid.uID = uId ? ++uId : uId=1;
14-
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
15-
nid.uCallbackMessage = TRAYICON_MESSAGE;
16-
nid.hIcon = GetWindowIcon(hWnd);
17-
GetWindowText(hWnd, nid.szTip, 128);
18-
nid.uVersion = NOTIFYICON_VERSION;
19-
}
20-
21-
TrayIcon::~TrayIcon()
22-
{
23-
Hide();
24-
}
25-
26-
void TrayIcon::SetCallBackMessage(UINT uMessage)
27-
{
28-
nid.uCallbackMessage = uMessage;
29-
}
30-
31-
UINT TrayIcon::Show()
32-
{
33-
if(Shell_NotifyIcon(NIM_ADD, &nid))
34-
{
35-
return uId;
36-
}
37-
return NULL;
38-
}
39-
40-
BOOL TrayIcon::Hide()
41-
{
42-
return Shell_NotifyIcon(NIM_DELETE, &nid);
43-
}
44-
45-
// Private
46-
HICON TrayIcon::GetWindowIcon(HWND hWnd)
47-
{
48-
HICON hIcon;
49-
hIcon = (HICON) SendMessage(hWnd, WM_GETICON, ICON_SMALL, NULL);
50-
if(hIcon)
51-
{
52-
return hIcon;
53-
}
54-
55-
hIcon = (HICON) GetClassLongPtr(hWnd, GCLP_HICONSM);
56-
if(hIcon)
57-
{
58-
return hIcon;
59-
}
60-
61-
hIcon = (HICON) SendMessage(hWnd, WM_GETICON, ICON_BIG, NULL);
62-
if(hIcon)
63-
{
64-
return hIcon;
65-
}
66-
67-
hIcon = (HICON) GetClassLongPtr(hWnd, GCLP_HICON);
68-
if(hIcon)
69-
{
70-
return hIcon;
71-
}
72-
73-
return hIcon;
1+
#include "stdafx.h"
2+
#include "TrayIcon.h"
3+
4+
Tray_Map mTrays;
5+
UINT TrayIcon::uId = 0;
6+
7+
TrayIcon::TrayIcon(HWND hWnd)
8+
{
9+
ZeroMemory(&nid, sizeof(NOTIFYICONDATA));
10+
11+
nid.cbSize = sizeof(NOTIFYICONDATA);
12+
nid.hWnd = hWnd;
13+
nid.uID = uId ? ++uId : uId = 1;
14+
nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
15+
nid.uCallbackMessage = TRAYICON_MESSAGE;
16+
nid.hIcon = GetWindowIcon(hWnd);
17+
GetWindowText(hWnd, nid.szTip, 128);
18+
nid.uVersion = NOTIFYICON_VERSION;
19+
}
20+
21+
TrayIcon::~TrayIcon()
22+
{
23+
Hide();
24+
}
25+
26+
void TrayIcon::SetCallBackMessage(UINT uMessage)
27+
{
28+
nid.uCallbackMessage = uMessage;
29+
}
30+
31+
UINT TrayIcon::Show()
32+
{
33+
if (Shell_NotifyIcon(NIM_ADD, &nid))
34+
{
35+
return uId;
36+
}
37+
return NULL;
38+
}
39+
40+
BOOL TrayIcon::Hide()
41+
{
42+
return Shell_NotifyIcon(NIM_DELETE, &nid);
43+
}
44+
45+
// Private
46+
HICON TrayIcon::GetWindowIcon(HWND hWnd)
47+
{
48+
HICON hIcon;
49+
hIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_SMALL, NULL);
50+
if (hIcon)
51+
{
52+
return hIcon;
53+
}
54+
55+
hIcon = (HICON)GetClassLongPtr(hWnd, GCLP_HICONSM);
56+
if (hIcon)
57+
{
58+
return hIcon;
59+
}
60+
61+
hIcon = (HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, NULL);
62+
if (hIcon)
63+
{
64+
return hIcon;
65+
}
66+
67+
hIcon = (HICON)GetClassLongPtr(hWnd, GCLP_HICON);
68+
if (hIcon)
69+
{
70+
return hIcon;
71+
}
72+
73+
return hIcon;
7474
}

0 commit comments

Comments
 (0)