MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / createWindow

Method createWindow

LuaSTGPlus/SplashWindow.cpp:64–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void SplashWindow::createWindow()
65{
66 WNDCLASS wc = { 0 };
67 wc.style = 0;
68 wc.lpfnWndProc = WndProc;
69 wc.cbClsExtra = 0;
70 wc.cbWndExtra = 0;
71 wc.hInstance = GetModuleHandle(NULL);
72 wc.hIcon = NULL;
73 wc.hCursor = LoadCursor(NULL, IDC_WAIT);
74 wc.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_WINDOW);
75 wc.lpszMenuName = NULL;
76 wc.lpszClassName = CLASSNAME;
77
78 RegisterClass(&wc);
79
80 m_hHandle = CreateWindowEx(0,
81 CLASSNAME,
82 TEXT("Loading..."),
83 WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP,
84 0,
85 0,
86 m_bkImage->GetWidth(),
87 m_bkImage->GetHeight(),
88 NULL,
89 NULL,
90 GetModuleHandle(NULL),
91 0);
92 SetWindowLongPtr(m_hHandle, GWLP_USERDATA, (LONG)(LONG_PTR)this);
93
94 // �������
95 SetWindowLong(m_hHandle, GWL_EXSTYLE, WS_EX_TOOLWINDOW | WS_EX_LAYERED);
96
97 // ���´�������
98 HDC dcDest = GetDC(m_hHandle);
99 HDC dcSrc;
100 dcSrc = CreateCompatibleDC(dcDest);
101 HBITMAP bmpDest;
102 bmpDest = CreateCompatibleBitmap(dcDest, m_bkImage->GetWidth(), m_bkImage->GetHeight());
103 SelectObject(dcSrc, bmpDest);
104
105 Graphics g(dcSrc);
106 g.DrawImage(m_bkImage, 0, 0, m_bkImage->GetWidth(), m_bkImage->GetHeight());
107
108 BLENDFUNCTION tBlend;
109 tBlend.BlendOp = 0;
110 tBlend.BlendFlags = 0;
111 tBlend.AlphaFormat = 1;
112 tBlend.SourceConstantAlpha = 255;
113
114 POINT tZero = { 0, 0 };
115 SIZE tSize = { static_cast<LONG>(m_bkImage->GetWidth()), static_cast<LONG>(m_bkImage->GetHeight()) };
116
117 UpdateLayeredWindow(m_hHandle, dcDest, &tZero, &tSize, dcSrc, &tZero, 0, &tBlend, ULW_ALPHA);
118
119 DeleteObject(bmpDest);
120 DeleteDC(dcSrc);
121 g.ReleaseHDC(dcSrc);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected