Why this cout is not showed?

Viewed 85

This cout << "x pos: " << p.x << " | y pos: " << p.y << endl; isn't showed How can I solve it? Am I missing some parts of code? The program T18 Wired Gaming Mouse is a test program. Everything works well but the last COUT is not showed.

#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;

int main ()
{

    while (true)
    {
        LPCWSTR window_title = L"T18 Wired Gaming Mouse";
        HWND hwND = FindWindow(NULL, window_title);
        while (hwND == NULL)
        {
            hwND = FindWindow(NULL, window_title);
            cout << "start program" << endl;
        }
        Sleep(10);
        if (GetAsyncKeyState(VK_NUMPAD0))
        {
            POINT p;
            GetCursorPos(&p);
            ScreenToClient(hwND, &p);
            cout << "x pos: " << p.x << " | y pos: " << p.y << endl;
            Sleep(1000);
        }
    }
}
0 Answers
Related