return;
ok(classatom, "failed to register class\n");
+ ok(GetClipboardFormatNameW(classatom, str, ARRAY_SIZE(str)) != 0, "atom not found\n");
+
ok(!RegisterClassW (&cls),
"RegisterClass of the same class should fail for the second time\n");
}
/* check GetClassName */
- i = GetClassNameW(hTestWnd, str, sizeof(str)/sizeof(str[0]));
+ i = GetClassNameW(hTestWnd, str, ARRAY_SIZE(str));
ok(i == lstrlenW(className),
"GetClassName returned incorrect length\n");
ok(!lstrcmpW(className,str),
ok(UnregisterClassW(className, hInstance),
"UnregisterClass() failed\n");
+ ok(GetClipboardFormatNameW(classatom, str, ARRAY_SIZE(str)) == 0,
+ "atom still found\n");
return;
}
"ScrollBar",
"#32770", /* dialog */
};
- static const int NUM_NORMAL_CLASSES = (sizeof(NORMAL_CLASSES)/sizeof(NORMAL_CLASSES[0]));
static const char classA[] = "deftest";
static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
WCHAR unistring[] = {0x142, 0x40e, 0x3b4, 0}; /* a string that would be destroyed by a W->A->W conversion */
WCHAR buf[128];
ATOM atom;
HWND hwnd;
- int i;
+ unsigned int i;
pDefWindowProcA = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcA");
pDefWindowProcW = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcW");
ok(IsWindowUnicode(hwnd) ||
broken(!IsWindowUnicode(hwnd)) /* Windows 8 and 10 */,
"Windows should be Unicode\n");
- SendMessageW(hwnd, WM_GETTEXT, sizeof(buf) / sizeof(buf[0]), (LPARAM)buf);
+ SendMessageW(hwnd, WM_GETTEXT, ARRAY_SIZE(buf), (LPARAM)buf);
if (IsWindowUnicode(hwnd))
ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
else
/* For most of the builtin controls both GetWindowLongPtrA and W returns a pointer that is executed directly
* by CallWindowProcA/W */
- for (i = 0; i < NUM_NORMAL_CLASSES; i++)
+ for (i = 0; i < ARRAY_SIZE(NORMAL_CLASSES); i++)
{
WNDPROC procA, procW;
hwnd = CreateWindowExA(0, NORMAL_CLASSES[i], classA, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 680, 260,
static LRESULT WINAPI TestDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- return DefWindowProcA(hWnd, uMsg, wParam, lParam);
+ return DefDlgProcA(hWnd, uMsg, wParam, lParam);
}
static BOOL RegisterTestDialog(HINSTANCE hInstance)
static void test_extra_values(void)
{
int i;
- for(i=0; i< sizeof(extra_values)/sizeof(extra_values[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(extra_values); i++)
{
WNDCLASSEXA wcx;
BOOL ret = GetClassInfoExA(NULL,extra_values[i].name,&wcx);
SetLastError(0xdeadbeef);
ret = GetClassInfoExA(0, "static", &wcx);
ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
+ ok(GetLastError() == 0xdeadbeef, "Unexpected error code %d\n", GetLastError());
ok(wcx.cbSize == 0, "expected 0, got %u\n", wcx.cbSize);
ok(wcx.lpfnWndProc != NULL, "got null proc\n");
name++;
- GetTempPathA(sizeof(path)/sizeof(path[0]), path);
+ GetTempPathA(ARRAY_SIZE(path), path);
strcat(path, "comctl32_class.manifest");
create_manifest_file(path, comctl32_manifest);
if (!ret)
goto skiptest;
- MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, sizeof(nameW)/sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW));
ret = GetClassInfoW( 0, nameW, &wcW );
ok( ret, "GetClassInfoW failed for %s\n", name );
module = GetModuleHandleA( "comctl32" );
ret = GetClassInfoA( 0, name, &wcA );
ok( ret || broken(!ret) /* <= winxp */, "GetClassInfoA failed for %s\n", name );
if (!ret) return;
- MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, sizeof(nameW)/sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW));
ret = GetClassInfoW( 0, nameW, &wcW );
ok( ret, "GetClassInfoW failed for %s\n", name );
module = GetModuleHandleA( "comctl32" );
};
winetest_get_mainargs( &argv );
- for (i = 0; i < sizeof(classes) / sizeof(classes[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(classes); i++)
{
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof( startup );
ATOM class;
HINSTANCE hinst;
char buff[64];
- HWND hwnd;
+ HWND hwnd, hwnd2;
char path[MAX_PATH];
- GetTempPathA(sizeof(path)/sizeof(path[0]), path);
+ GetTempPathA(ARRAY_SIZE(path), path);
strcat(path, "actctx_classes.manifest");
create_manifest_file(path, main_manifest);
hwnd = CreateWindowExA(0, testclass, "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0);
ok(hwnd != NULL, "Failed to create a window.\n");
+ hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL);
+ ok(hwnd2 == hwnd, "Failed to find test window.\n");
+
+ hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL);
+ ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2);
+
ret = GetClassNameA(hwnd, buff, sizeof(buff));
ok(ret, "Failed to get class name.\n");
ok(!strcmp(buff, testclass), "Unexpected class name.\n");
DestroyWindow(hwnd);
+ hwnd = CreateWindowExA(0, "4.3.2.1!MyTestClass", "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0);
+ ok(hwnd != NULL, "Failed to create a window.\n");
+
+ hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL);
+ ok(hwnd2 == hwnd, "Failed to find test window.\n");
+
+ hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL);
+ ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2);
+
+ DestroyWindow(hwnd);
+
ret = UnregisterClassA("MyTestClass", hinst);
ok(!ret, "Unexpected ret value %d.\n", ret);