Files
Slnkdwf/Standalone/SLNKDWFViewer.cpp
Jos Groot Lipman 80d0142c23 SLNKDWF 2.00
svn path=/Slnkdwf/trunk/; revision=12481
2007-08-01 13:42:28 +00:00

77 lines
1.5 KiB
C++

// SLNKDwfViewer.cpp : main source file for SLNKDwfViewer.exe
//
#include "stdafx.h"
#include "resource.h"
CAppModule _Module;
HINSTANCE g_hInstance;
int Run(LPTSTR lpstrCmdLine, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CMainFrame wndMain;
if(wndMain.CreateEx() == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
if (*lpstrCmdLine)
{
CString s(lpstrCmdLine);
if (s[0] == '\"')
s = s.Mid(1, s.GetLength()-2);
wndMain.SetDWF(s);
}
else
{
CFileDialog dlg(TRUE, _T("dwf"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("DWF Files (*.dwf)\0*.dwf\0All Files (*.*)\0*.*\0"));
if(dlg.DoModal() == IDOK)
{
wndMain.SetDWF(CString(dlg.m_szFileName));
}
else
return 0;
}
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
return nRet;
}
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
g_hInstance = hInstance;
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
// AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); // add flags to support other controls
HRESULT hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet;
try
{
nRet = Run(lpstrCmdLine, nCmdShow);
}
catch (...)
{
int y=1;
}
_Module.Term();
return nRet;
}