Esempio n. 1
0
static void test_button_class(void)
{
    static const WCHAR testW[] = {'t','e','s','t',0};
    WNDCLASSEXW exW, ex2W;
    WNDCLASSEXA exA;
    char buffA[100];
    WCHAR *nameW;
    HWND hwnd;
    BOOL ret;
    int len;

    ret = GetClassInfoExA(NULL, WC_BUTTONA, &exA);
    ok(ret, "got %d\n", ret);
    todo_wine
    ok(IS_WNDPROC_HANDLE(exA.lpfnWndProc), "got %p\n", exA.lpfnWndProc);

    ret = GetClassInfoExW(NULL, WC_BUTTONW, &exW);
    ok(ret, "got %d\n", ret);
    ok(!IS_WNDPROC_HANDLE(exW.lpfnWndProc), "got %p\n", exW.lpfnWndProc);

    /* check that versioned class is also accessible */
    nameW = get_versioned_classname(WC_BUTTONW);
    ok(lstrcmpW(nameW, WC_BUTTONW), "got %s\n", wine_dbgstr_w(nameW));

    ret = GetClassInfoExW(NULL, nameW, &ex2W);
    todo_wine {
        ok(ret, "got %d\n", ret);
        ok(ex2W.lpfnWndProc == exW.lpfnWndProc, "got %p, %p\n", exW.lpfnWndProc, ex2W.lpfnWndProc);
    }

    /* Check reported class name */
    hwnd = create_button(BS_CHECKBOX, NULL);
    len = GetClassNameA(hwnd, buffA, sizeof(buffA));
    ok(len == strlen(buffA), "got %d\n", len);
    ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

    len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
    ok(len == strlen(buffA), "got %d\n", len);
    ok(!strcmp(buffA, "Button"), "got %s\n", buffA);
    DestroyWindow(hwnd);

    /* explicitely create with versioned class name */
    hwnd = CreateWindowExW(0, nameW, testW, BS_CHECKBOX, 0, 0, 50, 14, NULL, 0, 0, NULL);
    todo_wine
    ok(hwnd != NULL, "failed to create a window %s\n", wine_dbgstr_w(nameW));
    if (hwnd)
    {
        len = GetClassNameA(hwnd, buffA, sizeof(buffA));
        ok(len == strlen(buffA), "got %d\n", len);
        ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

        len = RealGetWindowClassA(hwnd, buffA, sizeof(buffA));
        ok(len == strlen(buffA), "got %d\n", len);
        ok(!strcmp(buffA, "Button"), "got %s\n", buffA);

        DestroyWindow(hwnd);
    }
}
Esempio n. 2
0
static void test_window(HWND hwnd)
{
    WINDOWINFO wi = {sizeof(wi)};
    char class_name[100];
    int i;
    BOOL res;

    i = RealGetWindowClassA(hwnd, class_name, sizeof(class_name));
    ok(!strncmp(class_name, "ATL:", 4), "class_name = %s %d\n", class_name, i);

    res = GetWindowInfo(hwnd, &wi);
    ok(res, "GetWindowInfo failed: %u\n", GetLastError());

    test_rect_size(&wi.rcWindow, 400, 410);
    test_rect_size(&wi.rcClient, 400, 410);

    ok(wi.dwStyle == (WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE|WS_CHILD), "dwStyle = %x\n", wi.dwStyle);
    ok(!(wi.dwExStyle & ~0x800 /* undocumented, set by some versions */), "dwExStyle = %x\n", wi.dwExStyle);

    ok(IsWindowVisible(hwnd), "Window is not visible\n");
}