1 // stdafx.h : include file for standard system include files,
2 // or project specific include files that are used frequently, but
3 // are changed infrequently
8 * @brief Project-wide includes and declarations
13 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
15 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
17 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
19 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
22 // On Win XP, with VS2008, do not use default WINVER 0x0600 because of
23 // some windows structure used in API (on VISTA they are longer)
25 # define WINVER 0x0501
26 #endif /* !defined(WINVER) */
28 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
32 #include <afxwin.h> // MFC core and standard components
33 #include <afxext.h> // MFC extensions
34 #include <afxcmn.h> // MFC support for Windows Common Controls
36 #include <afxtempl.h> // MFC C++ template collection classes
37 #include <afxpriv.h> // MFC private declarations (crystal text needs but doesn't include this)
38 #include <afxole.h> // MFC OLE (COM) support
42 // For CSizingControlBar
49 #include <unordered_set>
62 * @name User-defined Windows-messages
65 /// Directory compare thread asks UI (view) update
66 const UINT MSG_UI_UPDATE = WM_USER + 1;
67 /// Request to save panesizes
68 const UINT MSG_STORE_PANESIZES = WM_USER + 2;
69 /// Request to generate file compare report
70 const UINT MSG_GENERATE_FLIE_COMPARE_REPORT = WM_USER + 3;
73 /// Seconds ignored in filetime differences if option enabled
74 static const UINT SmallTimeDiff = 2;
76 #include "UnicodeString.h"
79 /** @brief Wrapper around CMergeApp::TranslateDialog() */
80 void NTAPI LangTranslateDialog(HWND);
82 /** @brief Lang aware version of AfxMessageBox() */
83 int NTAPI LangMessageBox(UINT, UINT nType = MB_OK, UINT nIDHelp = (UINT)-1);
85 /** @brief include for the custom dialog boxes, with do not ask/display again */
86 #include "MessageBoxDialog.h"
91 #define _MAX_PATH (260 * sizeof(wchar_t) / sizeof(TCHAR))
96 #define MAX_PATH (260 * sizeof(wchar_t) / sizeof(TCHAR))
101 #define MAX_PATH_FULL (32767 * sizeof(wchar_t) / sizeof(TCHAR))
103 #define WMPROFILE(x) CWinMergeProfile __wmtl__(x)
105 class CWinMergeProfile
109 static CMapStringToPtr map;
110 static LARGE_INTEGER origin;
115 explicit CWinMergeProfile(LPCTSTR pFuncName) {
117 _stprintf_s(buf, _T("%-*s funcname=%s Start\n"), level, L"", pFuncName);
118 OutputDebugString(buf);
119 lstrcpy(funcname, pFuncName);
120 QueryPerformanceFrequency(&freq);
121 QueryPerformanceCounter(&li[0]);
122 if (origin.QuadPart == 0)
126 ~CWinMergeProfile() {
127 QueryPerformanceCounter(&li[1]);
130 int elapsed = (int)((double)(li[1].QuadPart - li[0].QuadPart) / freq.QuadPart*1000.0*1000.0);
131 int tim = (int)((double)(li[1].QuadPart - origin.QuadPart) / freq.QuadPart*1000.0*1000.0);
136 void *pstatv = nullptr;
137 if (!map.Lookup(funcname, pstatv))
140 map[funcname] = (void *)pstat;
144 pstat = reinterpret_cast<stat *>(pstatv);
146 pstat->sum += elapsed;
148 _stprintf_s(buf, _T("%-*s funcname=%s t=%d[us] count=%d sum=%d[us] time=%g[ms]\n"), level, L"", funcname, elapsed, pstat->count, pstat->sum, tim/1000.0);
149 OutputDebugString(buf);
151 static void ResetTimer()
153 QueryPerformanceCounter(&origin);
155 static void Terminiate()