MCPcopy Create free account
hub / github.com/TheRealMJP/Shadows / MakeWindow

Method MakeWindow

Shadows/SampleFramework11/Window.cpp:108–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void Window::MakeWindow(LPCWSTR sIconResource, LPCWSTR sSmallIconResource, LPCWSTR sMenuResource)
109{
110
111 HICON hIcon = NULL;
112 if(sIconResource)
113 {
114 hIcon = reinterpret_cast<HICON>(::LoadImage(hinstance,
115 sIconResource,
116 IMAGE_ICON,
117 0,
118 0,
119 LR_DEFAULTCOLOR));
120 }
121
122 HICON hSmallIcon = NULL;
123 if(sSmallIconResource)
124 {
125 hIcon = reinterpret_cast<HICON>(::LoadImage(hinstance,
126 sSmallIconResource,
127 IMAGE_ICON,
128 0,
129 0,
130 LR_DEFAULTCOLOR));
131 }
132
133 HCURSOR hCursor = ::LoadCursorW(NULL, IDC_ARROW);
134
135 // Register the window class
136 WNDCLASSEX wc = { sizeof(WNDCLASSEX),
137 CS_DBLCLKS,
138 WndProc,
139 0,
140 0,
141 hinstance,
142 hIcon,
143 hCursor,
144 NULL,
145 sMenuResource,
146 appName.c_str(),
147 hSmallIcon
148 };
149
150 if (!::RegisterClassEx(&wc))
151 throw Win32Exception(::GetLastError());
152
153 // Create the application's window
154 hwnd = ::CreateWindowEx(exStyle,
155 appName.c_str(),
156 appName.c_str(),
157 style,
158 CW_USEDEFAULT,
159 CW_USEDEFAULT,
160 CW_USEDEFAULT,
161 CW_USEDEFAULT,
162 NULL,
163 NULL,
164 hinstance,
165 (void*)this

Callers

nothing calls this directly

Calls 1

Win32ExceptionClass · 0.85

Tested by

no test coverage detected