forked from deepskystacker/DSS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeepSkyStackerLive.cpp
154 lines (118 loc) · 3.56 KB
/
DeepSkyStackerLive.cpp
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
143
144
145
146
147
148
149
150
151
152
153
154
// DeepSkyStackerLive.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "DeepSkyStackerLive.h"
#include "DeepSkyStackerLiveDlg.h"
#include <gdiplus.h>
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")
#include "registry.h"
#include "SetUILanguage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CDeepSkyStackerLiveApp
BEGIN_MESSAGE_MAP(CDeepSkyStackerLiveApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CDeepSkyStackerLiveApp construction
CDeepSkyStackerLiveApp::CDeepSkyStackerLiveApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
// The one and only CDeepSkyStackerLiveApp object
CDeepSkyStackerLiveApp theApp;
/* ------------------------------------------------------------------- */
CDeepSkyStackerLiveApp * GetDSSLiveApp()
{
return &theApp;
};
using namespace std;
/* ------------------------------------------------------------------- */
// CDeepSkyStackerLiveApp initialization
BOOL CDeepSkyStackerLiveApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
AfxInitRichEdit2();
AfxSocketInit();
CWinApp::InitInstance();
// Standard initialization
SetRegistryKey(_T("DeepSkyStacker"));
return FALSE;
}
/* ------------------------------------------------------------------- */
BOOL IsExpired()
{
BOOL bResult = FALSE;
/*
#ifdef DSSBETA
SYSTEMTIME SystemTime;
LONG lMaxYear = DSSBETAEXPIREYEAR;
LONG lMaxMonth = DSSBETAEXPIREMONTH;
GetSystemTime(&SystemTime);
if ((SystemTime.wYear>lMaxYear) ||
((SystemTime.wYear==lMaxYear) && (SystemTime.wMonth>lMaxMonth)))
{
AfxMessageBox("This beta version has expired\nYou can probably get another one or download the final release from the web site.", MB_OK | MB_ICONSTOP);
bResult = TRUE;
};
#endif
*/
return bResult;
};
/* ------------------------------------------------------------------- */
int WINAPI _tWinMain(HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPTSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
ZFUNCTRACE_RUNTIME();
int nRetCode = 0;
OleInitialize(NULL);
SetUILanguage();
#ifndef NOGDIPLUS
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartupOutput gdiSO;
ULONG_PTR gdiplusToken;
ULONG_PTR gdiHookToken;
// Initialize GDI+.
gdiplusStartupInput.SuppressBackgroundThread = TRUE;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, &gdiSO);
gdiSO.NotificationHook(&gdiHookToken);
#endif
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
theApp.InitInstance();
if (!IsExpired())
{
CDeepSkyStackerLiveDlg dlg;
theApp.m_pMainWnd = &dlg;
//dlg.DragAcceptFiles(TRUE);
dlg.DoModal();
};
}
#ifndef NOGDIPLUS
// Shutdown GDI+
gdiSO.NotificationUnhook(gdiHookToken);
GdiplusShutdown(gdiplusToken);
#endif
OleUninitialize();
return nRetCode;
};
/* ------------------------------------------------------------------- */