swprintf not converting values
<p>I am trying to use the function as a way to display the X and Y values of the mouse in a Win32 application. It replaces the x value, but for the y it sets it to zero. I cannot figure out why, and I have set a breakpoint during the application. Y is not 0.</p>

<p>Edit
I changed the data type to int and for some reason it is now working. I originally had it at the long long because I was handling the input differently, and the function required that data type. I forgot to change it back. I am not quite sure why it did not work with long long though.</p>

<pre><code>LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;

static long long x = -1, y = -1;

switch (message)
{
case WM_MOUSEMOVE:
    {
        x = LOWORD(lParam);
        y = HIWORD(lParam);
        InvalidateRect(hWnd, 0, TRUE);

        break;
    }
case WM_COMMAND:
    wmId    = LOWORD(lParam);
    wmEvent = HIWORD(wParam);
    // Parse the menu selections:
    switch (wmId)
    {
    case IDM_ABOUT:
        DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
        break;
    case IDM_EXIT:
        DestroyWindow(hWnd);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    break;
case WM_PAINT:
    {
        hdc = BeginPaint(hWnd, &amp;ps);

        RECT rect;
        rect.left = x + 20;
        rect.top = y - 20;
        rect.right = x + 200;
        rect.bottom = y + 200;

        wchar_t displayMessage[100];
        swprintf(displayMessage, 100, L"(%d, %d)", x, y);

        DrawText(hdc, displayMessage, -1, &amp;rect, NULL);

        EndPaint(hWnd, &amp;ps);
        break;
    }
case WM_DESTROY:
    PostQuitMessage(0);
    break;
default:
    return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
</code></pre>
