1 /* 2 * PROJECT: ReactOS api tests 3 * LICENSE: GPL - See COPYING in the top level directory 4 * PURPOSE: Test for GetDCEx 5 * PROGRAMMERS: Timo Kreuzer 6 */ 7 8 #include "precomp.h" 9 10 #define DCX_USESTYLE 0x00010000 11 12 void Test_GetDCEx_Params() 13 { 14 15 } 16 17 static 18 LRESULT 19 CALLBACK 20 WndProc( 21 _In_ HWND hwnd, 22 _In_ UINT uMsg, 23 _In_ WPARAM wParam, 24 _In_ LPARAM lParam) 25 { 26 return TRUE; 27 } 28 29 static 30 ATOM 31 RegisterClassHelper( 32 PSTR pszClassName, 33 UINT style, 34 WNDPROC pfnWndProc) 35 { 36 WNDCLASSA cls; 37 38 cls.style = style; 39 cls.lpfnWndProc = pfnWndProc; 40 cls.cbClsExtra = 0; 41 cls.cbWndExtra = 0; 42 cls.hInstance = GetModuleHandleA(0); 43 cls.hIcon = 0; 44 cls.hCursor = LoadCursorA(0, IDC_ARROW); 45 cls.hbrBackground = GetStockObject(WHITE_BRUSH); 46 cls.lpszMenuName = NULL; 47 cls.lpszClassName = pszClassName; 48 49 return RegisterClassA(&cls); 50 } 51 52 static 53 HWND 54 CreateWindowHelper( 55 PSZ pszClassName, 56 PSZ pszTitle) 57 { 58 return CreateWindowA(pszClassName, 59 pszTitle, 60 WS_OVERLAPPEDWINDOW, 61 CW_USEDEFAULT, 62 CW_USEDEFAULT, 63 100, 64 100, 65 NULL, 66 NULL, 67 0, 68 NULL); 69 } 70 71 static 72 void 73 Test_GetDCEx_Cached() 74 { 75 static const PSTR pszClassName = "TestClass_Cached"; 76 ATOM atomClass; 77 HWND hwnd; 78 HDC hdc1, hdc2; 79 HRGN hrgn; 80 81 atomClass = RegisterClassHelper(pszClassName, 0, WndProc); 82 ok(atomClass != 0, "Failed to register class\n"); 83 84 hwnd = CreateWindowHelper(pszClassName, "Test Window1"); 85 ok(hwnd != NULL, "Failed to create hwnd\n"); 86 87 hdc1 = GetDCEx(hwnd, 0, 0); 88 ok(hdc1 == NULL, "GetDCEx should fail\n"); 89 hrgn = CreateRectRgn(0, 0, 100, 100); 90 hdc1 = GetDCEx(hwnd, hrgn, 0); 91 ok(hdc1 == NULL, "GetDCEx should fail\n"); 92 93 hdc1 = GetDCEx(hwnd, 0, DCX_WINDOW); 94 ok(hdc1 == NULL, "GetDCEx should fail\n"); 95 hdc1 = GetDCEx(hwnd, hrgn, DCX_WINDOW); 96 ok(hdc1 == NULL, "GetDCEx should fail\n"); 97 98 hdc1 = GetDCEx(hwnd, hrgn, DCX_INTERSECTRGN); 99 ok(hdc1 == NULL, "GetDCEx should fail\n"); 100 101 hdc1 = GetDCEx(hwnd, hrgn, DCX_PARENTCLIP); 102 ok(hdc1 != NULL, "GetDCEx failed\n"); 103 ReleaseDC(hwnd, hdc1); 104 105 hdc1 = GetDCEx(hwnd, hrgn, DCX_WINDOW | DCX_INTERSECTRGN | DCX_PARENTCLIP); 106 ok(hdc1 != NULL, "GetDCEx failed\n"); 107 ReleaseDC(hwnd, hdc1); 108 109 hdc1 = GetDCEx(hwnd, 0, DCX_CACHE); 110 ok(hdc1 != NULL, "GetDCEx failed\n"); 111 ReleaseDC(hwnd, hdc1); 112 113 hrgn = CreateRectRgn(0, 0, 100, 100); 114 hdc2 = GetDCEx(hwnd, hrgn, DCX_CACHE); 115 ok(hdc2 != NULL, "GetDCEx failed\n"); 116 ReleaseDC(hwnd, hdc2); 117 ok(hdc2 == hdc1, "Expected the same DC\n"); 118 119 hdc1 = GetDCEx(hwnd, 0, DCX_CACHE); 120 hdc2 = GetDCEx(hwnd, hrgn, DCX_CACHE); 121 ok(hdc1 != NULL, "GetDCEx failed\n"); 122 ok(hdc2 != hdc1, "Expected a different DC\n"); 123 ReleaseDC(hwnd, hdc1); 124 ReleaseDC(hwnd, hdc2); 125 126 hdc1 = GetDCEx(NULL, NULL, 0); 127 ok(hdc1 != NULL, "GetDCEx failed\n"); 128 hdc2 = GetDCEx(NULL, NULL, 0); 129 ok(hdc2 != NULL, "GetDCEx failed\n"); 130 ok(hdc2 != hdc1, "Expected a different DC\n"); 131 ReleaseDC(hwnd, hdc1); 132 ReleaseDC(hwnd, hdc2); 133 134 ok(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION, "region is not valid"); 135 136 DestroyWindow(hwnd); 137 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 138 "UnregisterClass failed"); 139 } 140 141 static 142 void 143 Test_GetDCEx_CS_OWNDC() 144 { 145 static const PSTR pszClassName = "TestClass_CS_OWNDC"; 146 ATOM atomClass; 147 HWND hwnd; 148 HDC hdc1, hdc2; 149 //HRGN hrgn; 150 151 atomClass = RegisterClassHelper(pszClassName, CS_OWNDC, WndProc); 152 ok(atomClass != 0, "Failed to register class\n"); 153 154 hwnd = CreateWindowHelper(pszClassName, "Test Window1"); 155 ok(hwnd != NULL, "Failed to create hwnd\n"); 156 157 hdc1 = GetDCEx(hwnd, NULL, 0); 158 ok(hdc1 != NULL, "GetDCEx failed\n"); 159 hdc2 = GetDCEx(hwnd, NULL, 0); 160 ok(hdc2 != NULL, "GetDCEx failed\n"); 161 ok(hdc2 == hdc1, "Expected the same DC\n"); 162 ok(ReleaseDC(hwnd, hdc1) == TRUE, "ReleaseDC failed\n"); 163 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 164 165 hdc2 = GetDCEx(hwnd, NULL, 0); 166 ok(hdc2 == hdc1, "Expected the same DC\n"); 167 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 168 169 hdc2 = GetDCEx(hwnd, NULL, DCX_CACHE); 170 ok(hdc2 != hdc1, "Expected a different DC\n"); 171 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 172 173 hdc2 = GetDCEx(hwnd, NULL, DCX_WINDOW); 174 ok(hdc2 == hdc1, "Expected the same DC\n"); 175 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 176 177 /* Try after resetting CS_OWNDC in the class */ 178 ok(SetClassLongPtrA(hwnd, GCL_STYLE, 0) == CS_OWNDC, "class style wrong\n"); 179 hdc2 = GetDCEx(hwnd, NULL, 0); 180 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 181 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 182 183 /* Try after setting CS_CLASSDC in the class */ 184 ok(SetClassLongPtrA(hwnd, GCL_STYLE, CS_CLASSDC) == 0, "class style not set\n"); 185 hdc2 = GetDCEx(hwnd, NULL, 0); 186 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 187 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 188 189 /* CS_OWNDC and CS_CLASSDC? Is that even legal? */ 190 ok(SetClassLongPtrA(hwnd, GCL_STYLE, (CS_OWNDC | CS_CLASSDC)) == CS_CLASSDC, "class style not set\n"); 191 hdc2 = GetDCEx(hwnd, NULL, 0); 192 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 193 ok(ReleaseDC(hwnd, hdc2) == TRUE, "ReleaseDC failed\n"); 194 195 SetClassLongPtrA(hwnd, GCL_STYLE, CS_OWNDC); 196 197 DestroyWindow(hwnd); 198 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 199 "UnregisterClass failed"); 200 } 201 202 static 203 void 204 Test_GetDCEx_CS_CLASSDC() 205 { 206 static const PSTR pszClassName = "TestClass_CS_CLASSDC"; 207 ATOM atomClass; 208 HWND hwnd1, hwnd2; 209 HDC hdc1, hdc2; 210 //HRGN hrgn; 211 212 atomClass = RegisterClassHelper(pszClassName, CS_CLASSDC, WndProc); 213 ok(atomClass != 0, "Failed to register class\n"); 214 215 hwnd1 = CreateWindowHelper(pszClassName, "Test Window1"); 216 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 217 218 /* Looks legit, but this is not the DC you are looking for! 219 In fact this is NOT the class dc, but an own DC, doh! 220 When the first Window is created, the DC for that Window is both it's own 221 AND the class DC. But we only get the class DC, when using DCX_USESTYLE */ 222 hdc1 = GetDCEx(hwnd1, NULL, 0); 223 ok(hdc1 != NULL, "GetDCEx failed\n"); 224 hdc2 = GetDCEx(hwnd1, NULL, 0); 225 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 226 ok(ReleaseDC(hwnd1, hdc1) == TRUE, "ReleaseDC failed\n"); 227 ok(ReleaseDC(hwnd1, hdc2) == TRUE, "ReleaseDC failed\n"); 228 229 /* Now with DCX_USESTYLE */ 230 hdc2 = GetDCEx(hwnd1, NULL, DCX_USESTYLE); 231 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 232 ok(ReleaseDC(hwnd1, hdc2) == TRUE, "ReleaseDC failed\n"); 233 234 hwnd2 = CreateWindowHelper(pszClassName, "Test Window2"); 235 ok(hwnd2 != NULL, "Failed to create hwnd2\n"); 236 237 /* Yeah, this doesn't work anymore. Once the */ 238 hdc2 = GetDCEx(hwnd2, NULL, 0); 239 ok(hdc2 == NULL, "Expected failure\n"); 240 241 /* Now with DCX_USESTYLE ... */ 242 hdc2 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 243 ok(hdc2 == hdc1, "Expected the same DC, got %p\n", hdc2); 244 ok(ReleaseDC(hwnd2, hdc2) == TRUE, "ReleaseDC failed\n"); 245 246 SendMessage(hwnd2, WM_USER, 0, 0); 247 248 DestroyWindow(hwnd1); 249 DestroyWindow(hwnd2); 250 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 251 "UnregisterClass failed"); 252 } 253 254 static 255 void 256 Test_GetDCEx_CS_Mixed() 257 { 258 static const PSTR pszClassName = "TestClass_CS_Mixed"; 259 ATOM atomClass; 260 HWND hwnd1,hwnd2, hwnd3; 261 HDC hdc1, hdc2, hdc3; 262 263 /* Register a class with CS_OWNDC *and* CS_CLASSDC */ 264 atomClass = RegisterClassHelper(pszClassName, CS_OWNDC | CS_CLASSDC, WndProc); 265 ok(atomClass != 0, "Failed to register class\n"); 266 267 /* Create the first window, this should create a single own and class DC */ 268 hwnd1 = CreateWindowHelper(pszClassName, "Test Window1"); 269 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 270 271 /* Verify that we have the right style */ 272 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == (CS_OWNDC | CS_CLASSDC), 273 "class style not set\n"); 274 275 /* This is now the class DC and the first windows own DC */ 276 hdc1 = GetDCEx(hwnd1, NULL, 0); 277 ok(hdc1 != NULL, "GetDCEx failed\n"); 278 ok(ReleaseDC(hwnd1, hdc1) == TRUE, "ReleaseDC failed\n"); 279 280 /* This should get us the own/class DC again */ 281 hdc2 = GetDCEx(hwnd1, NULL, 0); 282 ok(hdc2 == hdc1, "Expected the own/class DC, got %p\n", hdc2); 283 ok(ReleaseDC(hwnd1, hdc2) == TRUE, "ReleaseDC failed\n"); 284 285 /* This should get us the class DC, but it's the same */ 286 hdc2 = GetDCEx(hwnd1, NULL, DCX_USESTYLE); 287 ok(hdc2 == hdc1, "Expected the own/class DC, got %p\n", hdc2); 288 ok(ReleaseDC(hwnd1, hdc2) == TRUE, "ReleaseDC failed\n"); 289 290 /* Create a second window */ 291 hwnd2 = CreateWindowHelper(pszClassName, "Test Window1"); 292 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 293 294 /* This should get us the own DC of the new window */ 295 hdc2 = GetDCEx(hwnd2, NULL, 0); 296 ok(hdc2 != NULL, "GetDCEx failed\n"); 297 ok(hdc2 != hdc1, "Expected different DC\n"); 298 ok(ReleaseDC(hwnd2, hdc2) == TRUE, "ReleaseDC failed\n"); 299 300 /* This gets us the own DC again, CS_OWNDC has priority! */ 301 hdc3 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 302 ok(hdc3 == hdc2, "Expected the own DC, got %p\n", hdc3); 303 ok(ReleaseDC(hwnd2, hdc3) == TRUE, "ReleaseDC failed\n"); 304 305 /* Disable CS_OWNDC */ 306 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, CS_CLASSDC) == (CS_OWNDC | CS_CLASSDC), "unexpected style\n"); 307 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == CS_CLASSDC, "class style not set\n"); 308 309 /* Since the window already has an own DC, we get it again! */ 310 hdc3 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 311 ok(hdc3 == hdc2, "Expected the own DC, got %p\n", hdc3); 312 ok(ReleaseDC(hwnd2, hdc3) == TRUE, "ReleaseDC failed\n"); 313 314 /* Disable CS_CLASSDC, too */ 315 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, 0) == CS_CLASSDC, "unexpected style\n"); 316 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == 0, "class style not set\n"); 317 318 /* With DCX_USESTYLE we only get a cached DC */ 319 hdc3 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 320 ok(hdc3 != NULL, "GetDCEx failed\n"); 321 ok(hdc3 != hdc1, "Expected different DC, got class DC\n"); 322 ok(hdc3 != hdc2, "Expected different DC, got own DC\n"); 323 ok(ReleaseDC(hwnd2, hdc3) == TRUE, "ReleaseDC failed\n"); 324 325 /* Without DCX_USESTYLE we get the own DC */ 326 hdc3 = GetDCEx(hwnd2, NULL, 0); 327 ok(hdc3 != NULL, "GetDCEx failed\n"); 328 ok(hdc3 != hdc1, "Expected different DC, got class DC\n"); 329 ok(hdc3 == hdc2, "Expected the own DC, got %p\n", hdc3); 330 ok(ReleaseDC(hwnd2, hdc3) == TRUE, "ReleaseDC failed\n"); 331 332 /* Set only CS_OWNDC */ 333 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, CS_OWNDC) == 0, "unexpected style\n"); 334 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == CS_OWNDC, "class style not set\n"); 335 336 hwnd3 = CreateWindowHelper(pszClassName, "Test Window1"); 337 ok(hwnd3 != NULL, "Failed to create hwnd1\n"); 338 339 /* This should get a new own DC */ 340 hdc2 = GetDCEx(hwnd3, NULL, 0); 341 ok(hdc2 != hdc1, "Expected different DC\n"); 342 ok(ReleaseDC(hwnd3, hdc2) == TRUE, "ReleaseDC failed\n"); 343 344 /* Re-enable CS_CLASSDC */ 345 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, (CS_OWNDC | CS_CLASSDC)) == CS_OWNDC, "unexpected style\n"); 346 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == (CS_OWNDC | CS_CLASSDC), "class style not set\n"); 347 348 /* This should get us the own DC */ 349 hdc3 = GetDCEx(hwnd3, NULL, 0); 350 ok(hdc3 == hdc2, "Expected the same DC, got %p\n", hdc3); 351 ok(ReleaseDC(hwnd3, hdc3) == TRUE, "ReleaseDC failed\n"); 352 353 /* This should still get us the new own DC */ 354 hdc3 = GetDCEx(hwnd3, NULL, DCX_USESTYLE); 355 ok(hdc3 == hdc2, "Expected the same DC, got %p\n", hdc3); 356 ok(ReleaseDC(hwnd3, hdc3) == TRUE, "ReleaseDC failed\n"); 357 358 /* Disable CS_OWNDC */ 359 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, CS_CLASSDC) == (CS_OWNDC | CS_CLASSDC), "unexpected style\n"); 360 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == CS_CLASSDC, "class style not set\n"); 361 362 /* This should get us the own DC */ 363 hdc3 = GetDCEx(hwnd3, NULL, 0); 364 ok(hdc3 == hdc2, "Expected the same DC, got %p\n", hdc3); 365 ok(ReleaseDC(hwnd3, hdc3) == TRUE, "ReleaseDC failed\n"); 366 367 /* This should still get us the new own DC */ 368 hdc3 = GetDCEx(hwnd3, NULL, DCX_USESTYLE); 369 ok(hdc3 == hdc2, "Expected the same DC, got %p\n", hdc3); 370 ok(ReleaseDC(hwnd3, hdc3) == TRUE, "ReleaseDC failed\n"); 371 372 /* cleanup for a second run */ 373 DestroyWindow(hwnd1); 374 DestroyWindow(hwnd2); 375 DestroyWindow(hwnd3); 376 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 377 "UnregisterClass failed\n"); 378 379 /* Create class again with CS_OWNDC */ 380 atomClass = RegisterClassHelper(pszClassName, CS_OWNDC, WndProc); 381 ok(atomClass != 0, "Failed to register class\n"); 382 383 hwnd1 = CreateWindowHelper(pszClassName, "Test Window1"); 384 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 385 386 /* This is the windows own DC, the class does not have a class DC yet */ 387 hdc1 = GetDCEx(hwnd1, NULL, 0); 388 ok(hdc1 != NULL, "GetDCEx failed\n"); 389 ok(ReleaseDC(hwnd1, hdc1) == TRUE, "ReleaseDC failed\n"); 390 391 /* Enable only CS_CLASSDC */ 392 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, CS_CLASSDC) == CS_OWNDC, "unexpected style\n"); 393 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == CS_CLASSDC, "class style not set\n"); 394 395 /* Create a second window. Now we should create a class DC! */ 396 hwnd2 = CreateWindowHelper(pszClassName, "Test Window2"); 397 ok(hwnd2 != NULL, "Failed to create hwnd1\n"); 398 399 /* We expect a new DCE (the class DCE) */ 400 hdc2 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 401 ok(hdc2 != NULL, "GetDCEx failed\n"); 402 ok(hdc2 != hdc1, "Expected different DCs\n"); 403 ok(ReleaseDC(hwnd2, hdc2) == TRUE, "ReleaseDC failed\n"); 404 405 /* cleanup */ 406 DestroyWindow(hwnd1); 407 DestroyWindow(hwnd2); 408 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 409 "UnregisterClass failed\n"); 410 } 411 412 static 413 void 414 Test_GetDCEx_CS_SwitchedStyle() 415 { 416 static const PSTR pszClassName = "TestClass_CS_SwitchedStyle"; 417 ATOM atomClass; 418 HWND hwnd1, hwnd2; 419 HDC hdc1, hdc2, hdcClass; 420 421 /* Create a class with CS_CLASSDC */ 422 atomClass = RegisterClassHelper(pszClassName, CS_CLASSDC, WndProc); 423 ok(atomClass != 0, "Failed to register class\n"); 424 425 /* Create the 2 windows */ 426 hwnd1 = CreateWindowHelper(pszClassName, "Test Window1"); 427 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 428 hwnd2 = CreateWindowHelper(pszClassName, "Test Window2"); 429 ok(hwnd2 != NULL, "Failed to create hwnd2\n"); 430 431 /* Get the class DC from the Windows */ 432 hdc1 = GetDCEx(hwnd1, NULL, DCX_USESTYLE); 433 hdc2 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 434 hdcClass = hdc1; 435 ok(hdc1 == hdc2, "Expected same DC\n"); 436 ok(ReleaseDC(hwnd2, hdc2) == TRUE, "ReleaseDC failed\n"); 437 438 /* Switch the class to CS_OWNDC */ 439 ok(SetClassLongPtrA(hwnd1, GCL_STYLE, CS_OWNDC) == CS_CLASSDC, "unexpected style\n"); 440 ok(GetClassLongPtrA(hwnd1, GCL_STYLE) == CS_OWNDC, "class style not set\n"); 441 442 /* Release the DC and try to get another one, this should fail now */ 443 ok(ReleaseDC(hwnd1, hdc1) == TRUE, "ReleaseDC failed\n"); 444 hdc1 = GetDCEx(hwnd1, NULL, DCX_USESTYLE); 445 ok(hdc1 == NULL, "GetDCEx should fail\n"); 446 447 /* Destroy the 1st window, this should move it's own DC to the cache, 448 but not the class DC, but they are the same, so... */ 449 DestroyWindow(hwnd1); 450 451 /* Create another window, this time it should have it's own DC */ 452 hwnd1 = CreateWindowHelper(pszClassName, "Test Window1"); 453 ok(hwnd1 != NULL, "Failed to create hwnd1\n"); 454 hdc1 = GetDCEx(hwnd1, NULL, DCX_USESTYLE); 455 ok(hdc1 != NULL, "GetDXEx failed\n"); 456 ok(hdc1 != hdc2, "Should get different DC\n"); 457 458 /* Switch the class back to CS_CLASSDC */ 459 ok(SetClassLongPtrA(hwnd2, GCL_STYLE, CS_CLASSDC) == CS_OWNDC, "unexpected style\n"); 460 ok(GetClassLongPtrA(hwnd2, GCL_STYLE) == CS_CLASSDC, "class style not set\n"); 461 462 /* Get the 2nd window's DC, this should still be the class DC */ 463 hdc2 = GetDCEx(hwnd2, NULL, DCX_USESTYLE); 464 ok(hdc2 != hdc1, "Expected different DC\n"); 465 ok(hdc2 == hdcClass, "Expected class DC\n"); 466 467 DestroyWindow(hwnd1); 468 DestroyWindow(hwnd2); 469 ok(UnregisterClass(pszClassName, GetModuleHandleA(0)) == TRUE, 470 "UnregisterClass failed\n"); 471 } 472 473 START_TEST(GetDCEx) 474 { 475 Test_GetDCEx_Params(); 476 Test_GetDCEx_Cached(); 477 Test_GetDCEx_CS_OWNDC(); 478 Test_GetDCEx_CS_CLASSDC(); 479 Test_GetDCEx_CS_Mixed(); 480 Test_GetDCEx_CS_SwitchedStyle(); 481 } 482