|
1.¿ä¾à ¾Æ¹«·± ±â´Éµµ ¾ø´Â ÀϹÝÀûÀÎ Child Window¸¦ ¸¸µé¾î º¸µµ·Ï ÇϰڽÀ´Ï´Ù. ÀÌ·± Window´Â ¸ðµç WindowÀÇ ±âº»À̱⠶§¹®¿¡ ³ª ÀڽŸ¸ÀÇ »õ·Î¿î Control¸¦ ¸¸µé ¶§ À¯¿ëÇÏ°Ô »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. 2.º»¹® Windows Program¿¡¼ Window¸¦ »ý¼ºÇϱâ À§ÇØ »ç¿ëµÇ´Â ÇÔ¼ö´Â Create()ÀÔ´Ï´Ù. ¸ðµç Window´Â ÀÌ ÇÔ¼ö¸¦ ÅëÇØ¼ ¸¸µé¾îÁö°í, ClassName°ú Style¿¡ µû¶ó Windows¿¡¼ ±âº»ÀûÀ¸·Î Á¦°øÇÏ´Â Control(Button, Check, Edit..)À̳ª Dialog°¡ ¸¸µé¾î Áú ¼ö ÀÖ½À´Ï´Ù. 1) CWnd»ó¼Ó¹Þ´Â Class¸¦ »ý¼ºÇÑ´Ù. 2) Class Wizard¿¡¼ Create()ÇÔ¼ö¸¦ Ãß°¡ÇÑ´Ù. ±×·¯¸é ´ÙÀ½°ú °°Àº ÇÔ¼ö°¡ ¸¸µé¾î Áø´Ù.
virtual BOOL Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd,
UINT nID, CCreateContext* pContext)
ÇÔ¼ö Á¤ÀǸ¦ ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇØ ÁØ´Ù.
virtual BOOL Create(DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID);
BOOL CMyWnd::Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd,
UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the
base class
return CWnd::Create(lpszClassName, lpszWindowName,
dwStyle, rect, pParentWnd, nID, pContext);
}
ÀÌ°Ç ´ÙÀ½°ú °°ÀÌ ¹Ù²Û´Ù.
BOOL CMyWnd::Create(DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID)
{
return CWnd::Create(NULL, NULL, dwStyle, rect,
pParentWnd, nID, NULL);
}
3) ÀÌ·¸°Ô ÇÑ ´ÙÀ½ ÀÌ Window¸¦ »ý¼ºÇϰíÀÚÇÏ´Â °÷¿¡¼ ´ÙÀ½°ú °°ÀÌ ÇØÁÖ¸é µÈ´Ù.
CMyWnd MyWnd;
MyWnd.Create(WS_CHILD | WS_VISIBLE,
CRect(0, 0, 100, 100), this, ID_MYWND) ;
MyWnd.Invalidate(FALSE);
ÀÌ·¸°Ô ÇÏ¸é ±×³É »ç°¢ÇüÀ» ±×¸°°Å¿Í °°Àº 100X100 Å©±âÀÇ Window°¡ »ý¼º µÈ´Ù. CMyWnd¾È¿¡¼ WM_PAINT³ª ´Ù¸¥ Window Message¸¦ ÀÌ¿ëÇÏ¿© ¿©·¯°¡Áö ÀÛ¾÷À» ÇÒ ¼ö ÀÖ½À´Ï´Ù. - 2001.08.13 Smile Seo - |