@@ -35,7 +35,9 @@ class CAppModuleInitialization
3535 {
3636 HRESULT hr = m_module.Init (nullptr , hInstance);
3737 if (FAILED (hr))
38+ {
3839 Win32::ThrowWin32Error (hr, " CAppModule::Init" );
40+ }
3941 }
4042
4143 ~CAppModuleInitialization ()
@@ -110,16 +112,19 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
110112 CAppModuleInitialization moduleInit (_Module, hInstance);
111113
112114 HANDLE hStdIn = GetStdHandle (STD_INPUT_HANDLE);
113- HANDLE hFile = nullptr , hPipe = nullptr ;
115+ HANDLE hFile = nullptr ;
116+ HANDLE hPipe = nullptr ;
114117 switch (GetFileType (hStdIn))
115118 {
116119 case FILE_TYPE_DISK: hFile = hStdIn; break ;
117120 case FILE_TYPE_PIPE: hPipe = hStdIn; break ;
118121 default : break ;
119122 }
120123
121- if (hPipe && IsDBWinViewerActive ())
124+ if ((hPipe != nullptr ) && IsDBWinViewerActive ())
125+ {
122126 return ForwardMessagesFromPipe (hPipe);
127+ }
123128
124129 CMainFrame wndMain;
125130 MessageLoop theLoop (_Module);
@@ -141,23 +146,35 @@ int Main(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpstrCmdLine
141146 else if (args[i][0 ] != ' /' )
142147 {
143148 if (!fileName.empty ())
149+ {
144150 throw std::runtime_error (" multiple filenames specified on commandline" );
151+ }
145152 fileName = args[i];
146153 }
147154 }
148155
149156 if (wndMain.CreateEx () == nullptr )
157+ {
150158 Win32::ThrowLastError (L" Main window creation failed!" );
159+ }
151160
152161 wndMain.ShowWindow (cmdShow);
153162 if (boost::algorithm::iends_with (fileName, " .dbconf" ))
163+ {
154164 wndMain.LoadConfiguration (fileName);
165+ }
155166 else if (!fileName.empty ())
167+ {
156168 wndMain.Load (fileName, false );
157- else if (hFile)
169+ }
170+ else if (hFile != nullptr )
171+ {
158172 wndMain.Load (hFile);
159- else if (hPipe)
173+ }
174+ else if (hPipe != nullptr )
175+ {
160176 wndMain.CapturePipe (hPipe);
177+ }
161178
162179 return theLoop.Run ();
163180}
0 commit comments