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