RECT dlgRect = {0}; GetWindowRect(hWnd, &dlgRect); int widthResolution = GetSystemMetrics(SM_CXSCREEN); int heightResolution = GetSystemMetrics(SM_CYSCREEN); int newXPos = (widthResolution / 2) - (abs(dlgRect.right - dlgRect.left) / 2), newYPos = (heightResolution / 2) - (abs(dlgRect.bottom - dlgRect.top) / 2); SetWindowPos(hWnd, NULL, newXPos, newYPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER);