Tuesday, March 06, 2007

Create a Static control from CWnd

Howto create a Static control from CWnd....

void CMyDlg::OnCreateExtendedCtrl()
{
CWnd* pWnd = new CStatic;

pWnd->CreateEx(WS_EX_CLIENTEDGE,

_T("STATIC"), "Hi", WS_CHILD WS_TABSTOP WS_VISIBLE,

5, 5, 30, 30, m_hWnd, (HMENU)1234);

}

another way to do it ....

void CMyDlg::OnCreateControl()
{
CWnd* pWnd = new CWnd;
pWnd->Create(_T("STATIC"), "Hi", WS_CHILD WS_VISIBLE, CRect(0, 0, 20, 20), this, 1234);

}

No comments: