Oh sorry John
,
but I want to say thanks all of you, who helps me here....
Ok,
I tried this code, but the same as the getcursorpos....... then I have changed a litte bit, to see what happens:
while (GetMessage(&msg, NULL, 0, 0))
{
// GetCursorPos(&p);
GetCursorPosWinCE(&p);
GetAsyncKeyState(VK_LBUTTON); // for first time, clear buffer
if (GetAsyncKeyState(VK_LBUTTON) & 0x8000)
{
if (p.x > -1 && p.x < 480 && p.y > -1 && p.y < 272)
{
break;
}
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//MessageBeep(16);
swprintf(hStr1, L"%d %d", p.x , p.y );
MessageBox(NULL, hStr1, L"B2", MB_TOPMOST|MB_YESNO);
KillTimer(hwnd, 1);
DestroyWindow(hwnd);
return msg.wParam;
}
Now I see the MessageBox and it shows me for p.x = 0 und p.y = 0 (that´s wy I changed the if statement from 0 to -1)
Ok , now I took the break statement out, to get an endless loop,
the first time the messagebox comes up it shows me 0/0 for x and y, ....
I clicked OK and the next time it shows me the coordinates where i clicked the button NOT where I clicked on the screen.
I can reproduce it... it only shows me the point from the messagebox where I cleick YES or NO.
I hoped I would see the coordinates from that point I cleicked the screen....
Perhaps the code only works when a real notification was send???
Ok now I have a big unvisible button
,
Why will the GetCursorPos and GetCursorPosCe will not worl like you think?
Michael