2 * Copyright 2012 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include <wine/test.h>
34 static const GUID CLSID_Test =
35 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
36 #define CLSID_TEST_STR "178fc163-0000-0000-0000-000000000046"
38 static const GUID CATID_CatTest1 =
39 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x46}};
40 #define CATID_CATTEST1_STR "178fc163-0000-0000-0000-000000000146"
42 static const GUID CATID_CatTest2 =
43 {0x178fc163,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x46}};
44 #define CATID_CATTEST2_STR "178fc163-0000-0000-0000-000000000246"
46 static const char *debugstr_guid(REFIID riid)
53 sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
54 riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
55 riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
56 riid->Data4[5], riid->Data4[6], riid->Data4[7]);
61 static void test_winmodule(void)
63 _AtlCreateWndData create_data[3];
64 _ATL_WIN_MODULE winmod;
68 winmod.cbSize = 0xdeadbeef;
69 hres = AtlWinModuleInit(&winmod);
70 ok(hres == E_INVALIDARG, "AtlWinModuleInit failed: %08x\n", hres);
72 winmod.cbSize = sizeof(winmod);
73 winmod.m_pCreateWndList = (void*)0xdeadbeef;
74 winmod.m_csWindowCreate.LockCount = 0xdeadbeef;
75 winmod.m_rgWindowClassAtoms.m_aT = (void*)0xdeadbeef;
76 winmod.m_rgWindowClassAtoms.m_nSize = 0xdeadbeef;
77 winmod.m_rgWindowClassAtoms.m_nAllocSize = 0xdeadbeef;
78 hres = AtlWinModuleInit(&winmod);
79 ok(hres == S_OK, "AtlWinModuleInit failed: %08x\n", hres);
80 ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
81 ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n",
82 winmod.m_csWindowCreate.LockCount);
83 ok(winmod.m_rgWindowClassAtoms.m_aT == (void*)0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_aT = %p\n",
84 winmod.m_rgWindowClassAtoms.m_aT);
85 ok(winmod.m_rgWindowClassAtoms.m_nSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nSize = %d\n",
86 winmod.m_rgWindowClassAtoms.m_nSize);
87 ok(winmod.m_rgWindowClassAtoms.m_nAllocSize == 0xdeadbeef, "winmod.m_rgWindowClassAtoms.m_nAllocSize = %d\n",
88 winmod.m_rgWindowClassAtoms.m_nAllocSize);
90 InitializeCriticalSection(&winmod.m_csWindowCreate);
92 AtlWinModuleAddCreateWndData(&winmod, create_data, (void*)0xdead0001);
93 ok(winmod.m_pCreateWndList == create_data, "winmod.m_pCreateWndList != create_data\n");
94 ok(create_data[0].m_pThis == (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data[0].m_pThis);
95 ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
96 create_data[0].m_dwThreadID);
97 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
99 AtlWinModuleAddCreateWndData(&winmod, create_data+1, (void*)0xdead0002);
100 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
101 ok(create_data[1].m_pThis == (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data[1].m_pThis);
102 ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
103 create_data[1].m_dwThreadID);
104 ok(create_data[1].m_pNext == create_data, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
106 AtlWinModuleAddCreateWndData(&winmod, create_data+2, (void*)0xdead0003);
107 ok(winmod.m_pCreateWndList == create_data+2, "winmod.m_pCreateWndList != create_data\n");
108 ok(create_data[2].m_pThis == (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data[2].m_pThis);
109 ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
110 create_data[2].m_dwThreadID);
111 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
113 p = AtlWinModuleExtractCreateWndData(&winmod);
114 ok(p == (void*)0xdead0003, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
115 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
116 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
118 create_data[1].m_dwThreadID = 0xdeadbeef;
120 p = AtlWinModuleExtractCreateWndData(&winmod);
121 ok(p == (void*)0xdead0001, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
122 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
123 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
124 ok(!create_data[1].m_pNext, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
126 p = AtlWinModuleExtractCreateWndData(&winmod);
127 ok(!p, "unexpected AtlWinModuleExtractCreateWndData result %p\n", p);
128 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
131 #define test_key_exists(a,b) _test_key_exists(__LINE__,a,b)
132 static void _test_key_exists(unsigned line, HKEY root, const char *key_name)
137 res = RegOpenKeyA(root, key_name, &key);
138 ok_(__FILE__,line)(res == ERROR_SUCCESS, "Could not open key %s\n", key_name);
139 if(res == ERROR_SUCCESS)
143 #define test_key_not_exists(a,b) _test_key_not_exists(__LINE__,a,b)
144 static void _test_key_not_exists(unsigned line, HKEY root, const char *key_name)
149 res = RegOpenKeyA(root, key_name, &key);
150 ok_(__FILE__,line)(res == ERROR_FILE_NOT_FOUND, "Attempting to open %s returned %u\n", key_name, res);
151 if(res == ERROR_SUCCESS)
155 static void test_regcat(void)
160 const struct _ATL_CATMAP_ENTRY catmap[] = {
161 {_ATL_CATMAP_ENTRY_IMPLEMENTED, &CATID_CatTest1},
162 {_ATL_CATMAP_ENTRY_REQUIRED, &CATID_CatTest2},
163 {_ATL_CATMAP_ENTRY_END}
166 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, TRUE);
167 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
169 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
170 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories\\{" CATID_CATTEST1_STR "}");
171 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories\\{" CATID_CATTEST2_STR "}");
173 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, catmap, FALSE);
174 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
176 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Implemented Categories");
177 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}\\Required Categories");
178 test_key_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
180 ok(RegDeleteKeyA(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}") == ERROR_SUCCESS, "Could not delete key\n");
182 hres = AtlRegisterClassCategoriesHelper(&CLSID_Test, NULL, TRUE);
183 ok(hres == S_OK, "AtlRegisterClassCategoriesHelper failed: %08x\n", hres);
185 test_key_not_exists(HKEY_CLASSES_ROOT, "CLSID\\{" CLSID_TEST_STR "}");
188 hres = AtlGetPerUserRegistration(&b);
189 ok(hres == S_OK, "AtlGetPerUserRegistration failed: %08x\n", hres);
190 ok(!b, "AtlGetPerUserRegistration returned %x\n", b);
193 static void test_typelib(void)
201 static const WCHAR scrrun_dll_suffixW[] = {'\\','s','c','r','r','u','n','.','d','l','l',0};
202 static const WCHAR mshtml_tlb_suffixW[] = {'\\','m','s','h','t','m','l','.','t','l','b',0};
204 inst = LoadLibraryA("scrrun.dll");
205 ok(inst != NULL, "Could not load scrrun.dll\n");
208 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
209 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
212 len = SysStringLen(path);
213 ok(len > sizeof(scrrun_dll_suffixW)/sizeof(WCHAR)
214 && lstrcmpiW(path+len-sizeof(scrrun_dll_suffixW)/sizeof(WCHAR), scrrun_dll_suffixW),
215 "unexpected path %s\n", wine_dbgstr_w(path));
217 ok(typelib != NULL, "typelib == NULL\n");
218 ITypeLib_Release(typelib);
220 inst = LoadLibraryA("mshtml.dll");
221 ok(inst != NULL, "Could not load mshtml.dll\n");
224 hres = AtlLoadTypeLib(inst, NULL, &path, &typelib);
225 ok(hres == S_OK, "AtlLoadTypeLib failed: %08x\n", hres);
228 len = SysStringLen(path);
229 ok(len > sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR)
230 && lstrcmpiW(path+len-sizeof(mshtml_tlb_suffixW)/sizeof(WCHAR), mshtml_tlb_suffixW),
231 "unexpected path %s\n", wine_dbgstr_w(path));
233 ok(typelib != NULL, "typelib == NULL\n");
234 ITypeLib_Release(typelib);
237 static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, void **ppv)
239 if(IsEqualGUID(&IID_IConnectionPoint, riid)) {
244 ok(0, "unexpected call\n");
245 return E_NOINTERFACE;
248 static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
253 static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
258 static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *pIID)
260 ok(0, "unexpected call\n");
264 static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface,
265 IConnectionPointContainer **ppCPC)
267 ok(0, "unexpected call\n");
271 static int advise_cnt;
273 static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink,
276 ok(pUnkSink == (IUnknown*)0xdead0000, "pUnkSink = %p\n", pUnkSink);
277 *pdwCookie = 0xdeadbeef;
282 static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD dwCookie)
284 ok(dwCookie == 0xdeadbeef, "dwCookie = %x\n", dwCookie);
289 static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface,
290 IEnumConnections **ppEnum)
292 ok(0, "unexpected call\n");
296 static const IConnectionPointVtbl ConnectionPointVtbl =
298 ConnectionPoint_QueryInterface,
299 ConnectionPoint_AddRef,
300 ConnectionPoint_Release,
301 ConnectionPoint_GetConnectionInterface,
302 ConnectionPoint_GetConnectionPointContainer,
303 ConnectionPoint_Advise,
304 ConnectionPoint_Unadvise,
305 ConnectionPoint_EnumConnections
308 static IConnectionPoint ConnectionPoint = { &ConnectionPointVtbl };
310 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
311 REFIID riid, void **ppv)
313 if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
318 ok(0, "unexpected call\n");
322 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
327 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
332 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
333 IEnumConnectionPoints **ppEnum)
335 ok(0, "unexpected call\n");
339 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
340 REFIID riid, IConnectionPoint **ppCP)
342 ok(IsEqualGUID(riid, &CLSID_Test), "unexpected riid\n");
343 *ppCP = &ConnectionPoint;
347 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
348 ConnectionPointContainer_QueryInterface,
349 ConnectionPointContainer_AddRef,
350 ConnectionPointContainer_Release,
351 ConnectionPointContainer_EnumConnectionPoints,
352 ConnectionPointContainer_FindConnectionPoint
355 static IConnectionPointContainer ConnectionPointContainer = { &ConnectionPointContainerVtbl };
357 static void test_cp(void)
362 hres = AtlAdvise((IUnknown*)&ConnectionPointContainer, (IUnknown*)0xdead0000, &CLSID_Test, &cookie);
363 ok(hres == S_OK, "AtlAdvise failed: %08x\n", hres);
364 ok(cookie == 0xdeadbeef, "cookie = %x\n", cookie);
365 ok(advise_cnt == 1, "advise_cnt = %d\n", advise_cnt);
367 hres = AtlUnadvise((IUnknown*)&ConnectionPointContainer, &CLSID_Test, 0xdeadbeef);
368 ok(hres == S_OK, "AtlUnadvise failed: %08x\n", hres);
369 ok(!advise_cnt, "advise_cnt = %d\n", advise_cnt);
372 static CLSID persist_clsid;
374 static HRESULT WINAPI Persist_QueryInterface(IPersist *iface, REFIID riid, void **ppv)
376 ok(0, "unexpected call\n");
377 return E_NOINTERFACE;
380 static ULONG WINAPI Persist_AddRef(IPersist *iface)
385 static ULONG WINAPI Persist_Release(IPersist *iface)
390 static HRESULT WINAPI Persist_GetClassID(IPersist *iface, CLSID *pClassID)
392 *pClassID = persist_clsid;
396 static const IPersistVtbl PersistVtbl = {
397 Persist_QueryInterface,
403 static IPersist Persist = { &PersistVtbl };
405 static HRESULT WINAPI ProvideClassInfo2_QueryInterface(IProvideClassInfo2 *iface, REFIID riid, void **ppv)
407 ok(0, "unexpected call\n");
408 return E_NOINTERFACE;
411 static ULONG WINAPI ProvideClassInfo2_AddRef(IProvideClassInfo2 *iface)
416 static ULONG WINAPI ProvideClassInfo2_Release(IProvideClassInfo2 *iface)
421 static HRESULT WINAPI ProvideClassInfo2_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
423 ok(0, "unexpected call\n");
427 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideClassInfo2 *iface, DWORD dwGuidKind, GUID *pGUID)
429 ok(dwGuidKind == GUIDKIND_DEFAULT_SOURCE_DISP_IID, "unexpected dwGuidKind %x\n", dwGuidKind);
430 *pGUID = DIID_DispHTMLBody;
434 static const IProvideClassInfo2Vtbl ProvideClassInfo2Vtbl = {
435 ProvideClassInfo2_QueryInterface,
436 ProvideClassInfo2_AddRef,
437 ProvideClassInfo2_Release,
438 ProvideClassInfo2_GetClassInfo,
439 ProvideClassInfo2_GetGUID
442 static IProvideClassInfo2 ProvideClassInfo2 = { &ProvideClassInfo2Vtbl };
443 static BOOL support_classinfo2;
445 static HRESULT WINAPI Dispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
449 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
454 if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
455 if(!support_classinfo2)
456 return E_NOINTERFACE;
457 *ppv = &ProvideClassInfo2;
461 if(IsEqualGUID(&IID_IPersist, riid)) {
466 ok(0, "unexpected riid: %s\n", debugstr_guid(riid));
467 return E_NOINTERFACE;
470 static ULONG WINAPI Dispatch_AddRef(IDispatch *iface)
475 static ULONG WINAPI Dispatch_Release(IDispatch *iface)
480 static HRESULT WINAPI Dispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
482 ok(0, "unexpected call\n");
486 static HRESULT WINAPI Dispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid,
492 static const WCHAR mshtml_tlbW[] = {'m','s','h','t','m','l','.','t','l','b',0};
494 ok(!iTInfo, "iTInfo = %d\n", iTInfo);
495 ok(!lcid, "lcid = %x\n", lcid);
497 hres = LoadTypeLib(mshtml_tlbW, &typelib);
498 ok(hres == S_OK, "LoadTypeLib failed: %08x\n", hres);
500 hres = ITypeLib_GetTypeInfoOfGuid(typelib, &IID_IHTMLElement, ppTInfo);
501 ok(hres == S_OK, "GetTypeInfoOfGuid failed: %08x\n", hres);
503 ITypeLib_Release(typelib);
507 static HRESULT WINAPI Dispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
508 UINT cNames, LCID lcid, DISPID *rgDispId)
510 ok(0, "unexpected call\n");
514 static HRESULT WINAPI Dispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
515 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
516 EXCEPINFO *pExcepInfo, UINT *puArgErr)
518 ok(0, "unexpected call\n");
522 static const IDispatchVtbl DispatchVtbl = {
523 Dispatch_QueryInterface,
526 Dispatch_GetTypeInfoCount,
527 Dispatch_GetTypeInfo,
528 Dispatch_GetIDsOfNames,
532 static IDispatch Dispatch = { &DispatchVtbl };
534 static void test_source_iface(void)
536 unsigned short maj_ver, min_ver;
540 support_classinfo2 = TRUE;
542 maj_ver = min_ver = 0xdead;
543 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
544 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
545 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
546 ok(IsEqualGUID(&iid, &DIID_DispHTMLBody), "iid = %s\n", debugstr_guid(&iid));
547 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
549 support_classinfo2 = FALSE;
550 persist_clsid = CLSID_HTMLDocument;
552 maj_ver = min_ver = 0xdead;
553 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
554 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
555 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
556 ok(IsEqualGUID(&iid, &DIID_HTMLDocumentEvents), "iid = %s\n", debugstr_guid(&iid));
557 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
559 persist_clsid = CLSID_HTMLStyle;
561 maj_ver = min_ver = 0xdead;
562 hres = AtlGetObjectSourceInterface((IUnknown*)&Dispatch, &libid, &iid, &maj_ver, &min_ver);
563 ok(hres == S_OK, "AtlGetObjectSourceInterface failed: %08x\n", hres);
564 ok(IsEqualGUID(&libid, &LIBID_MSHTML), "libid = %s\n", debugstr_guid(&libid));
565 ok(IsEqualGUID(&iid, &IID_NULL), "iid = %s\n", debugstr_guid(&iid));
566 ok(maj_ver == 4 && min_ver == 0, "ver = %d.%d\n", maj_ver, min_ver);
569 static void test_ax_win(void)
573 static const WCHAR AtlAxWin100[] = {'A','t','l','A','x','W','i','n','1','0','0',0};
574 static const WCHAR AtlAxWinLic100[] = {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0};
575 static HMODULE hinstance = 0;
577 ret = AtlAxWinInit();
578 ok(ret, "AtlAxWinInit failed\n");
580 hinstance = GetModuleHandleA(NULL);
582 memset(&wcex, 0, sizeof(wcex));
583 wcex.cbSize = sizeof(wcex);
584 ret = GetClassInfoExW(hinstance, AtlAxWin100, &wcex);
585 ok(ret, "AtlAxWin100 has not registered\n");
586 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
588 memset(&wcex, 0, sizeof(wcex));
589 wcex.cbSize = sizeof(wcex);
590 ret = GetClassInfoExW(hinstance, AtlAxWinLic100, &wcex);
591 ok(ret, "AtlAxWinLic100 has not registered\n");
592 ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);