声明按钮对象
CButton m_wndBtn;
创建按钮对象
CRect rect;
//* 按钮
rectClient.left = 0;
rectClient.top = 35;
rectClient.right = 200;
rectClient.bottom = 35;
if (!m_wndButton.Create(_T("Button"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, rectClient, this, 7))
{
TRACE0("Failed to create button.");
return -1;
}
m_wndButton.ShowWindow(SW_SHOWNORMAL);
wndBtn.MoveWindow(rect.left, rect.top, rect.right, rect.bottom);//* 注意:CButton对SetWindowPos()免疫,此暂时也不知道是啥情况。请高手不吝赐教。