コード例 #1
0
LRESULT CALLBACK DWPTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int iwnd = get_iwnd(hWnd);

    if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
        return DefWindowProc(hWnd, message, wParam, lParam);

    switch(message)
    {
    case WM_IME_SETCONTEXT:
    case WM_IME_NOTIFY :
    case WM_GETICON :
    case WM_GETTEXT:
        break;
    case WM_WINDOWPOSCHANGING:
    case WM_WINDOWPOSCHANGED:
        {
            WINDOWPOS* pwp = (WINDOWPOS*)lParam;
            ok(wParam==0,"expected wParam=0\n");
            RECOND_MESSAGE(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter), pwp->flags);
            break;
        }
    default:
        RECOND_MESSAGE(iwnd, message, SENT, 0,0);
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}
コード例 #2
0
LRESULT CALLBACK TmeTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int iwnd = get_iwnd(hWnd);

    if(message == WM_PAINT)
    {
        PAINTSTRUCT ps;
        BeginPaint(hWnd, &ps);
        Rectangle(ps.hdc,  ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
        EndPaint(hWnd, &ps);
    }

    if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
        return DefWindowProc(hWnd, message, wParam, lParam);

    switch(message)
    {
    case WM_IME_SETCONTEXT:
    case WM_IME_NOTIFY :
    case WM_GETICON :
    case WM_GETTEXT:
        break;
    case WM_SYSTIMER:
        ok(0, "Got unexpected WM_SYSTIMER in the winproc. wParam=%d\n", wParam);
        break;
    default:
        RECOND_MESSAGE(iwnd, message, SENT, 0,0);
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}
コード例 #3
0
ファイル: SetActiveWindow.c プロジェクト: hoangduit/reactos
LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int iwnd = get_iwnd(hWnd);

    if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
        return DefWindowProc(hWnd, message, wParam, lParam);

    switch(message)
    {
    case WM_QUERYNEWPALETTE:
        {
            HDC hdc = GetDC(0);
            int bits = GetDeviceCaps(hdc,BITSPIXEL);
            ok( bits == 8 , "expected WM_QUERYNEWPALETTE only on 8bpp\n");
            ReleaseDC(0, hdc);
            return FALSE;
        }
    case WM_IME_SETCONTEXT:
    case WM_IME_NOTIFY :
    case WM_GETICON :
    case WM_GETTEXT:
        break;
    case WM_WINDOWPOSCHANGING:
    case WM_WINDOWPOSCHANGED:
        {
            WINDOWPOS* pwp = (WINDOWPOS*)lParam;
            ok(wParam==0,"expected wParam=0\n");
            RECOND_MESSAGE(iwnd, message, SENT, get_iwnd(pwp->hwndInsertAfter), pwp->flags);
            break;
        }
    default:
        RECOND_MESSAGE(iwnd, message, SENT, 0,0);
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
}
コード例 #4
0
ファイル: SendMessageTimeout.c プロジェクト: Moteesh/reactos
static
DWORD
WINAPI
Thread2(
    _Inout_opt_ PVOID Parameter)
{
    MSG msg;
    LRESULT ret;
    WPARAM wParam;

    hWndThread2 = CreateWindowExW(0, L"SendTest", NULL, 0,  10, 10, 20, 20,  NULL, NULL, 0, NULL);
    ok(hWndThread2 != NULL, "CreateWindow failed\n");

    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECORD_MESSAGE(2, msg.message, POST, 0, 0);
        DispatchMessageA(&msg);
    }

    wParam = (WPARAM)Parameter;
    ret = SendMessage(hWndThread1, WM_SENDTOOTHERTHREAD, wParam, dwThread2);
    ok(ret == 0, "ret = %lu\n", ret);

    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECORD_MESSAGE(2, msg.message, POST, 0, 0);
        DispatchMessageA(&msg);
    }

    DestroyWindow(hWndThread2);
    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECORD_MESSAGE(2, msg.message, POST, 0, 0);
        DispatchMessageA(&msg);
    }

    return 7;
}
コード例 #5
0
static void FlushMessages()
{
    MSG msg;

    while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
    {
        int iwnd = get_iwnd(msg.hwnd);
        if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECOND_MESSAGE(iwnd, msg.message, POST,0,0);
        DispatchMessageA( &msg );
    }
}
コード例 #6
0
ファイル: SendMessageTimeout.c プロジェクト: Moteesh/reactos
static
DWORD
WINAPI
Thread1(
    _Inout_opt_ PVOID Parameter)
{
    MSG msg;

    hWndThread1 = CreateWindowExW(0, L"SendTest", NULL, 0,  10, 10, 20, 20,  NULL, NULL, 0, NULL);
    ok(hWndThread1 != NULL, "CreateWindow failed\n");

    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECORD_MESSAGE(1, msg.message, POST, 0, 0);
        DispatchMessageA(&msg);
    }

    ResumeThread(hThread2);

    while (MsgWaitForMultipleObjectsEx(1, &hThread2, FALSE, QS_ALLEVENTS, MWMO_ALERTABLE) != WAIT_OBJECT_0)
    {
        while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        {
            if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
                RECORD_MESSAGE(1, msg.message, POST, 0, 0);
            DispatchMessageA(&msg);
        }
    }

    DestroyWindow(hWndThread1);
    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
    {
        if (!(msg.message > WM_USER || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
            RECORD_MESSAGE(1, msg.message, POST, 0, 0);
        DispatchMessageA(&msg);
    }

    return 6;
}
コード例 #7
0
ファイル: SendMessageTimeout.c プロジェクト: Moteesh/reactos
static
LRESULT
CALLBACK
WndProc(
    _In_ HWND hWnd,
    _In_ UINT message,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam)
{
    if (IsDWmMsg(message) || IseKeyMsg(message))
        return DefWindowProcW(hWnd, message, wParam, lParam);

    if (hWnd == hWndThread1)
    {
        RECORD_MESSAGE(1, message, SENT, wParam, lParam);
    }
    else if (hWnd == hWndThread2)
    {
        RECORD_MESSAGE(2, message, SENT, wParam, lParam);
    }
    else
    {
        RECORD_MESSAGE(3, message, SENT, wParam, lParam);
    }

    switch (message)
    {
    case WM_SENDTOOTHERTHREAD:
        if (GetCurrentThreadId() == dwThread1)
        {
            if ((wParam & KILL_THREAD2_FLAG) &&
                (wParam & ~KILL_THREAD_FLAGS) > 10)
            {
                TerminateThread(hThread2, 123);
            }
            if ((wParam & KILL_THREAD1_FLAG) &&
                (wParam & ~KILL_THREAD_FLAGS) > 10)
            {
                TerminateThread(hThread1, 456);
            }
            ok(lParam == dwThread2, "lParam = %Iu, expected %lu\n", lParam, dwThread2);
            return SendMessage(hWndThread2, WM_SENDTOOTHERTHREAD, wParam + 1, GetCurrentThreadId());
        }
        else
        {
            ok(lParam == dwThread1, "lParam = %Iu, expected %lu\n", lParam, dwThread1);
            return SendMessage(hWndThread1, WM_SENDTOOTHERTHREAD, wParam + 1, GetCurrentThreadId());
        }
    }

    return DefWindowProcW(hWnd, message, wParam, lParam);
}
コード例 #8
0
ファイル: SetParent.c プロジェクト: GYGit/reactos
static
LRESULT
CALLBACK
WndProc(
    _In_ HWND hWnd,
    _In_ UINT message,
    _In_ WPARAM wParam,
    _In_ LPARAM lParam)
{
    HWND hTest;
    int iwnd = get_iwnd(hWnd, TRUE);

    ok(GetCurrentThreadId() == dwThreadId, "Thread 0x%lx instead of 0x%lx\n", GetCurrentThreadId(), dwThreadId);
    if (message > WM_USER || IsDWmMsg(message) || IseKeyMsg(message))
        return DefWindowProcW(hWnd, message, wParam, lParam);

    RECORD_MESSAGE(iwnd, message, SENT, wParam, lParam);

    switch(message)
    {
    case WM_DESTROY:
        if (GetParent(hWnd))
        {
            /* child window */
            ok(EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Child window %p (%d) enumerated\n", hWnd, iwnd);
            ok(!EnumChildWindows(GetParent(hWnd), EnumProc, (LPARAM)hWnd), "Child window %p (%d) not enumerated\n", hWnd, iwnd);
            ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)GetParent(hWnd)), "Parent window of %p (%d) not enumerated\n", hWnd, iwnd);
        }
        else
        {
            /* top-level window */
            ok(!EnumThreadWindows(dwThreadId, EnumProc, (LPARAM)hWnd), "Window %p (%d) not enumerated in WM_DESTROY\n", hWnd, iwnd);
        }
        if (hWnd == hWndList[3])
        {
            hTest = SetParent(hWndList[4], hWndList[2]);
            ok_hwnd(hTest, hWndList[1]);
            hTest = SetParent(hWndList[5], hWndList[1]);
            ok_hwnd(hTest, hWndList[2]);

            ok_hwnd(GetParent(hWndList[1]), NULL);
            ok_hwnd(GetParent(hWndList[2]), NULL);
            ok_hwnd(GetParent(hWndList[3]), hWndList[1]);
            ok_hwnd(GetParent(hWndList[4]), hWndList[2]);
            ok_hwnd(GetParent(hWndList[5]), hWndList[1]);
        }
        break;
    }

    return DefWindowProcW(hWnd, message, wParam, lParam);
}
コード例 #9
0
static void FlushMessages()
{
    MSG msg;

    while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
    {
        int iwnd = get_iwnd(msg.hwnd);
        if(iwnd)
        {
            if(msg.message == WM_SYSTIMER)
            {
                RECOND_MESSAGE(iwnd, msg.message, POST,msg.wParam,0);
                if(ignore_timer)
                    continue;
            }
            else if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
                RECOND_MESSAGE(iwnd, msg.message, POST,0,0);
        }
        DispatchMessageA( &msg );
    }
}