Mitte des Fensters
-
Ich möchte die Mitte meines Fensters ermitteln im Bezug auf das Desktop Fenster.
Hier mit aheb ich es probiert... vergeblich...
RECT rect;
::GetWindowRect(hwnd, &rect);
long center_x = ::GetSystemMetrics(SM_CXFULLSCREEN)/2-(abs<long>(rect.left)+rect.right)/2;
long center_y = ::GetSystemMetrics(SM_CYFULLSCREEN)/2-(abs<long>(rect.top)+rect.bottom)/2;
::SetCursorPos(center_x, center_y);
-
Sowas ?

RECT rcWnd; GetWindowRect(hWnd, &rcWnd); int iXCenter = (GetSystemMetrics(SM_CXSCREEN) - (rcWnd.right - rcWnd.left)) / 2; int iYCenter = (GetSystemMetrics(SM_CYSCREEN) - (rcWnd.bottom - rcWnd.top)) / 2;