forked from leeter/WinMTR-refresh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinMTRMain.cpp
More file actions
143 lines (120 loc) · 4.01 KB
/
Copy pathWinMTRMain.cpp
File metadata and controls
143 lines (120 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
WinMTR
Copyright (C) 2010-2019 Appnor MSP S.A. - http://www.appnor.com
Copyright (C) 2019-2021 Leetsoftwerx
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//*****************************************************************************
// FILE: WinMTRMain.cpp
//
//
// HISTORY:
//
//
// -- versions 0.8
//
// - 01.18.2002 - Store LRU hosts in registry (v0.8)
// - 05.08.2001 - Replace edit box with combo box which hold last entered hostnames.
// Fixed a memory leak which caused program to crash after a long
// time running. (v0.7)
// - 11.27.2000 - Added resizing support and flat buttons. (v0.6)
// - 11.26.2000 - Added copy data to clipboard and posibility to save data to file as text or HTML.(v0.5)
// - 08.03.2000 - added double-click on hostname for detailed information (v0.4)
// - 08.02.2000 - fix icmp error codes handling. (v0.3)
// - 08.01.2000 - support for full command-line parameter specification (v0.2)
// - 07.30.2000 - support for command-line host specification
// by Silviu Simen (ssimen@ubisoft.ro) (v0.1b)
// - 07.28.2000 - first release (v0.1)
//*****************************************************************************
#include "WinMTRGlobal.h"
#include <locale>
#include <stdexcept>
#include "WinMTRMain.h"
import WinMTR.Help;
import WinMTR.CommandLineParser;
import WinMTR.Dialog;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
WinMTRMain WinMTRinst;
//*****************************************************************************
// BEGIN_MESSAGE_MAP
//
//
//*****************************************************************************
BEGIN_MESSAGE_MAP(WinMTRMain, CWinApp)
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
//*****************************************************************************
// WinMTRMain::WinMTRMain
//
//
//*****************************************************************************
WinMTRMain::WinMTRMain()
{
}
//*****************************************************************************
// WinMTRMain::InitInstance
//
//
//*****************************************************************************
BOOL WinMTRMain::InitInstance()
{
try {
std::locale::global(std::locale(".UTF8"));
}
catch (const std::runtime_error&) {
// The UI is Unicode regardless of the process locale. Older Windows 7
// installations may not expose the UTF-8 locale name, so keep running.
}
INITCOMMONCONTROLSEX commonControls{
.dwSize = sizeof(INITCOMMONCONTROLSEX),
.dwICC = ICC_WIN95_CLASSES | ICC_LINK_CLASS | ICC_STANDARD_CLASSES
};
InitCommonControlsEx(&commonControls);
AfxInitRichEdit2();
/*if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}*/
AfxEnableControlContainer();
WinMTRDialog mtrDialog;
utils::CWinMTRCommandLineParser cmd_info(mtrDialog);
ParseCommandLine(cmd_info);
cmd_info.Validate();
if (cmd_info.hasError()) {
requestedExitCode = 2;
return FALSE;
}
if (cmd_info.isAskingForHelp()) {
WinMTRHelp mtrHelp;
m_pMainWnd = &mtrHelp;
mtrHelp.DoModal();
return FALSE;
}
m_pMainWnd = &mtrDialog;
[[maybe_unused]]
auto nResponse = mtrDialog.DoModal();
return FALSE;
}
int WinMTRMain::ExitInstance()
{
CWinApp::ExitInstance();
return requestedExitCode;
}