/******************************************************************
函数名 :CenterWnd
参数 :HWND hWnd 为欲居中的窗体句柄
返回值 :无
功能描述 :将指定的窗体居中
Dev hankcs 2010
******************************************************************/
void CenterWnd(HWND hWnd)
{
RECT rWnd;
GetWindowRect(hWnd, &rWnd);
int nWnd_w = rWnd.right – rWnd.left;
int nWnd_h = rWnd.bottom – rWnd.top;
int nDC_w = GetSystemMetrics(SM_CXSCREEN);
int nDC_h = GetSystemMetrics(SM_CYSCREEN);
int nStartp_x = (nDC_w – nWnd_w)/2;
int nStartp_y = (nDC_h – nWnd_h)/2;
SetWindowPos(hWnd, HWND_NOTOPMOST, nStartp_x, nStartp_y, 0, 0, SWP_NOSIZE);
}