放牧代码和思想
专注自然语言处理、机器学习算法
    This thing called love. Know I would've. Thrown it all away. Wouldn't hesitate.

SDK窗体居中的函数

/******************************************************************
函数名        :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);
}

知识共享许可协议 知识共享署名-非商业性使用-相同方式共享码农场 » SDK窗体居中的函数

评论 欢迎留言

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

我的作品

HanLP自然语言处理包《自然语言处理入门》