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
|
#include "Bitmap.h"
#include "T2.h"
#include "T2OpenningWindow.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#line 27
IMPLEMENT_DYNCREATE(T2OpenningWindow, CFrameWnd)
T2OpenningWindow::T2OpenningWindow() {
_CC = 1;
#line 32
mBitmap = new Bitmap;
if (!mBitmap->LoadFile("T2.dat")) {
delete mBitmap;
mBitmap = NULL;
}
}
/*virtual*/ T2OpenningWindow::~T2OpenningWindow() {
if (mBitmap)
delete mBitmap;
}
BEGIN_MESSAGE_MAP(T2OpenningWindow, CFrameWnd)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
void T2OpenningWindow::ShowOpenningWindow() {
CString text;
mWndClass = AfxRegisterWndClass(0, NULL, (HBRUSH) GetStockObject(BLACK_BRUSH));
RECT windowRect;
windowRect.left = 0;
windowRect.top = 0;
windowRect.right = 640;
windowRect.bottom = 480;
Create(mWndClass, text, WS_MAXIMIZE | WS_POPUP, windowRect, AfxGetMainWnd(), NULL, WS_EX_TOPMOST);
RECT rect;
::GetWindowRect(::GetDesktopWindow(), &rect);
MoveWindow(-5, -5, rect.right + 10, rect.bottom + 10);
ShowWindow(SW_SHOW);
SetActiveWindow();
PlaySound(MAKEINTRESOURCE(1), AfxGetInstanceHandle(), SND_ASYNC | SND_NOWAIT | SND_RESOURCE);
T2_APP->app_vfB4();
DWORD startTick = GetTickCount();
while (labs(GetTickCount() - startTick) < 2000)
T2_APP->app_vfB4();
if (mBitmap)
_CC = 0;
InvalidateRect(NULL);
startTick = GetTickCount();
while (labs(GetTickCount() - startTick) < 3000)
T2_APP->app_vfB4();
ShowWindow(SW_HIDE);
DestroyWindow();
}
void T2OpenningWindow::OnPaint() {
#pragma var_order(rect, centerY, dc, centerX)
CPaintDC dc(this);
RECT rect;
::GetWindowRect(::GetDesktopWindow(), &rect);
int centerX = rect.right / 2;
int centerY = rect.bottom / 2;
if (_CC == 0) {
#pragma var_order(paletteH, width, height, hdc, palette)
HDC hdc = dc;
HPALETTE paletteH = mBitmap->CreatePalette();
CPalette palette;
SelectPalette(dc, paletteH, false);
RealizePalette(dc);
int width = mBitmap->GetWidth();
int height = mBitmap->GetHeight();
mBitmap->Draw(hdc, centerX - width / 2, centerY - height / 2);
SelectPalette(hdc, palette, false);
DeleteObject(paletteH);
}
if (_CC == 1) {
CDC newDC;
CBitmap bitmap;
bitmap.LoadBitmap(175);
newDC.CreateCompatibleDC(&dc);
newDC.SelectObject(&bitmap);
dc.SelectPalette(&mPalette, false);
dc.RealizePalette();
dc.BitBlt(centerX - 240, centerY - 188, 480, 376, &newDC, 0, 0, SRCCOPY);
}
}
void T2OpenningWindow::OnLButtonDown(UINT nFlags, CPoint point) {
CWnd::OnLButtonDown(nFlags, point);
}
BOOL T2OpenningWindow::OnEraseBkgnd(CDC *pDC) {
#pragma var_order(brush, pen, clientRect, windowRect)
CBrush brush;
brush.CreateSolidBrush(PALETTERGB(204, 204, 204));
CRect clientRect;
GetClientRect(clientRect);
CPen pen;
pen.CreatePen(PS_SOLID, 0, PALETTERGB(255, 0, 0));
CRect windowRect;
GetWindowRect(windowRect);
pDC->SelectObject(pen);
pDC->MoveTo(windowRect.right, windowRect.top);
pDC->LineTo(windowRect.left - 1, windowRect.top);
pDC->LineTo(windowRect.left - 1, windowRect.bottom);
pDC->MoveTo(windowRect.right, windowRect.top);
pDC->LineTo(windowRect.right, windowRect.bottom);
pDC->LineTo(windowRect.left, windowRect.bottom);
return CFrameWnd::OnEraseBkgnd(pDC);
}
|