|
¸ðµé¸®½º´ëÈ»óÀÚ¿Í À©µµ¿ì¸Þ½ÃÁö ¸¸µé±â |
|||||||||||||||||||||||||||||||||||||||||||
ÇнÀ¸ñÇ¥ |
||||||||||||||||||||||||||||||||||||||||||||
¸ðµ¥¸®½º´ëÈ»óÀÚ ±â¹Ý ¿¡Çø®ÄÉÀ̼ǰú À©µµ¿ì¸Þ¼¼Áö¸¦ ¸¸µå´Â ¹æ¹ýÀ» °øºÎÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
ÇнÀÁÖÁ¦ |
||||||||||||||||||||||||||||||||||||||||||||
¸Þ´º¿¡¼ ¸ðµé¸®½º¸¦ ¼±ÅÃÇÏ¸é ¸ðµ¨¸®½º ´ëÈ »óÀÚ°¡ ³ªÅ¸³ª¸ç ÀÌ´Â À̸§À» ¼±ÅÃÇÒ °æ¿ì ¹Ù·Î ¸ÞÀÎ ÇÁ·Î±×·¥µîÀ» ±¸µ¿ÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿ì¸®°¡ ¾Æ·¡ÇÑ±Û µî¿¡¼ ã±â¸¦ ½ÇÇàÇϸé ÀÌ·¯ÇÑ ÀÀ¿ë ÇÁ·Î±×·¥À» º¼ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ´Ü¿øÀÇ ³»¿ëÀº ¡°Visusal C++.NET ½ÇÀü ÇÁ·Î±×·¡¹Ö¡±,ÀÌÀç¿øÀú, °¡¸ÞÃâÆÇ»ç p428~p442¸¦ ÂüÁ¶ Çß½À´Ï´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||
¿¹½À³»¿ë |
||||||||||||||||||||||||||||||||||||||||||||
½Ì±Û´ÙÅ¥¸ÕÆ® |
||||||||||||||||||||||||||||||||||||||||||||
½Ç½À¹æ¹ý |
||||||||||||||||||||||||||||||||||||||||||||
¸ñ Â÷ |
||||||||||||||||||||||||||||||||||||||||||||
ÇÁ·Î±×·¥Àº ¾Õ¿¡¼ÀÇ Modal ÇÁ·Î±×·¥À» ±×´ë·Î »ç¿ë ÇÕ´Ï´Ù. 1. ´ÙÀ̾î·Î±× ¸®¼Ò½º Ãß°¡ ¡°Resource View¡±¿¡¼ ´ÙÀ̾î·Î±× ¸®¼Ò½º¸¦ Ãß°¡ÇÑ ÈÄ¿¡ ¾Æ·¡ Æ÷¸¦ ÂüÁ¶ÇÏ¿© ´ÙÀ̾î·Î±×¸¦ ±¸¼ºÇÑ´Ù. ´ÙÀ̾î·Î±×¹Ú½ºÀÇ ID´Â »ý¼ºµÇ´Â ±âº» °ªÀ» ±×´ë·Î »ç¿ëÇÑ´Ù.
2. ´ÙÀ̾î·Î±× Ŭ·¡½º Ãß°¡ À§¿¡¼ ´ÙÀ̾î·Î±×¸¦ °ü¸®Çϱâ À§ÇØ Å¬·¡½º¸¦ ¸¸µç´Ù. ¸¶¿ì½º·Î ´ÙÀ̾î·Î±× ¹Ú½º¸¦ ´õºíÅ©¸¯ Çϰųª ¸¶¿ì½º ¿À¸¥ÂÊ۸¦ ´·¯¼ ¡°Å¬·¡½º Ãß°¡¡±¸¦ ¼±ÅÃÇÑ´Ù. Ŭ·¡½º À̸§Àº ¡°CNameDlg¡±·Î ÀÔ·ÂÇÑ´Ù. 3. ¸ðµé¸®½º ´ëÈ »óÀÚÀÇ »ý¼º View Ŭ·¡½º¿¡ ¸ðµé¸®½º ´ëÈ»óÀÚ¸¦ °ü¸®Çϱâ À§ÇÑ CNameActDlgÀÇ °´Ã¼Æ÷ÀÎÅÍ m_pDlg¸¦ ¡°º¯¼öÃß°¡¡±¸¦ ÀÌ¿ëÇÏ¿© Ãß°¡ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||
¾Æ·¡¿Í °°ÀÌ ¡°CNameActDlg* m_pDlg;¡± °¡ ÀÚµ¿ ¼±¾ðµÈ °ÍÀ» º¼¼ö ÀÖÀ¸¸ç ¡°DialogTestView.cpp¡± ÀÇ »ý¼ºÀÚ ¡°CDialogTestView()¡±¿¡´Â ¡°m_pDlg(NULL)¡±¿Í °°ÀÌ NULL·Î ÃʱâÈ µÇ¾î ÀÖ´Â °ÍÀ» º¼ ¼ö ÀÖ´Ù.
DialogTestView.h¿¡ NameActDlg.h¸¦ include ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
// DialogTestView.h : CDialogTestView Ŭ·¡½ºÀÇÀÎÅÍÆäÀ̽º // #pragma once #include
"NameActDlg.h" class CDialogTestView : public
CView { protected: // serialization¿¡¼¸¸¸¸µé¾îÁý´Ï´Ù. CDialogTestView(); DECLARE_DYNCREATE(CDialogTestView) // Ư¼ºÀÔ´Ï´Ù. public: CDialogTestDoc*
GetDocument() const; // ÀÛ¾÷ÀÔ´Ï´Ù. public: // ÀçÁ¤ÀÇÀÔ´Ï´Ù. public: virtual void
OnDraw(CDC* pDC); // À̺並±×¸®±âÀ§ÇØÀçÁ¤ÀǵǾú½À´Ï´Ù. virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void
OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void
OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); // ±¸ÇöÀÔ´Ï´Ù. public: virtual ~CDialogTestView(); #ifdef _DEBUG virtual void
AssertValid() const; virtual void
Dump(CDumpContext& dc) const; #endif protected: // »ý¼ºµÈ¸Þ½ÃÁö¸ÊÇÔ¼ö protected: DECLARE_MESSAGE_MAP() public: afx_msg
void OnNameModal(); afx_msg
void OnNameModeless(); CNameActDlg* m_pDlg; }; #ifndef _DEBUG // DialogTestView.cppÀǵð¹ö±×¹öÀü inline CDialogTestDoc*
CDialogTestView::GetDocument() const { return
reinterpret_cast<CDialogTestDoc*>(m_pDocument); } #endif |
|
||||||||||||||||||||||||||||||||||||||||||
m_pDlgÀÇ ÃʱâÈ
|
||||||||||||||||||||||||||||||||||||||||||||
|
CDialogTestView::CDialogTestView() : m_pDlg(NULL) { // TODO: ¿©±â¿¡»ý¼ºÄڵ带Ãß°¡ÇÕ´Ï´Ù. }
|
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
¡°¸®¼Ò½ººä¡±¿¡ ¡°¸Þ´º¡± IDR_MAINFRAMEÀ» ¿°í ¾Æ·¡¿Í °°ÀÌ ¸Þ´ºÇ׸ñÀ» Ãß°¡ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
¸Þ´ºÇ׸ñ |
ID |
ºñ°í |
|
||||||||||||||||||||||||||||||||||||||||
|
À̸§ |
|
¸Þ´º¹Ù |
|
||||||||||||||||||||||||||||||||||||||||
|
À̸§¼±ÅÃ(Modeless) |
ID_NAME_MODELESS |
|
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
Ŭ·¡½ººä¿¡¼ ¡°CDialogTestView¡±Å¬·¡½º¸¦ ¼±ÅÃÇÏ°í ¿À¸¥ÂÊ ±×¸²°ú °°ÀÌ ¡°OnNameModeless¡± ¸í·É Çڵ鷯¸¦ Ãß°¡ ÇÑ´Ù. ¾Æ·¡¿Í °°ÀÌ °°ÀÌ ÇÁ·Î±×·¥ ÇÑ´Ù. If¹® Áß¿¡¼ else 󸮸¦ º¸¸é m_pDlg °´Ã¼¿¡ Æ÷ÀÎÅÍ ¸Þ¸ð¸®¸¦ ÇÒ´çÇϰí Create() ÇÔ¼ö¿¡ ´ÙÀ̾î·Î±× ¸®¼Ò½º ¡°IDD_DIALOG2¡±¸¦ ÀÎÀÚ·Î ÁöÁ¤ÇÏ¿© ½ÇÇàÇÔÀ¸·Î ´ëÈ»óÀÚ¸¦ »ý¼ºÇÑ ÈÄ¿¡ ShowWindow() ¸â¹ö ÇÔ¼ö¸¦ ÀÌ¿ëÇØ ȸ鿡 ³ªÅ¸³ª°Ô ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
void CDialogTestView::OnNameModeless() { // TODO: ¿©±â¿¡¸í·É󸮱âÄڵ带Ãß°¡ÇÕ´Ï´Ù. if(m_pDlg !=
NULL) m_pDlg->ShowWindow(SW_SHOW); else { m_pDlg
= new CNameActDlg; m_pDlg->Create(IDD_DIALOG2); m_pDlg->ShowWindow(SW_SHOW); } }
|
|
||||||||||||||||||||||||||||||||||||||||||
4. ¸ðµé¸®½º ´ëÈ»óÀÚÀÇ Á¾·á ¸ð´Þ ´ëÈ»óÀÚ´Â new¸¦ ÀÌ¿ëÇÑ ¸Þ¸ð¸® ÇÒ´çÀ» ÇÏÁö ¾Ê¾Æ [È®ÀÎ] [Ãë¼Ò] ¹öưÀ» ´©¸£¸é ÀÚµ¿À¸·Î Á¾·á µÇ¾ú´Ù. ±×·¯³ª ¸ðµé¸®½º ´ëÈ »óÀÚ´Â new,¸¦ ÀÌ¿ëÇØ ¸Þ¸ð¸®¸¦ ÇÒ´ç ÇÏ¿´À¸¹Ç·Î ´ÙÀ½ µÎ °¡Áö·Î ó¸®ÇÑ´Ù. ¨ç ¸Þ¸ð¸®¸¦ ³²°ÜµÎ¾î º¸ÀÌÁö ¾Ê°Ô ó¸®ÇÏ¿´´Ù. ´Ù½Ã ³ªÅ¸³½´Ù. ¨è ¸Þ¸ð¸®¸¦ »èÁ¦ÇÏ°í ³ª¿À¸ç, ´Ù½Ã ¸ð´Þ¸®½º ´ëÈ»óÀÚ¸¦ ¿
¶§´Â new¸¦ ÀÌ¿ëÇØ »õ·Î¿î ¸Þ¸ð¸®¿Í ´ëÈ»óÀÚ¸¦ ¸¸µç´Ù. (À©µ¿¿ì ¸Þ½ÃÁö¸¦ ÀÌ¿ëÇÏ¿© ó¸®) ´ÙÀ½Àº 1ÀÇ ¹æ¹ýÀ¸·Î ÇÁ·Î±×·¥ ÇÑ °ÍÀÌ´Ù. ÇÁ·Î±×·¥Àº ÀÌ»ó ¾øÀÌ µ¿ÀÛÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
À©µµ¿ì¸Þ½ÃÁö ¸¸µé±â |
||||||||||||||||||||||||||||||||||||||||||||
À̹ø¿¡´Â ´ëÈ»óÀÚ¸¦ ´ÝÀ» ¶§ ÇØ´ç Ŭ·¡½º¸¦ ¸ðµÎ delete ÇÏ¿© ¸Þ¸ð¸®¿¡¼ »èÁ¦ÇÏ°í ´Ù½Ã ´ëÈ»óÀÚ¸¦ ¿ ¶§´Â ¸Þ¸ð¸®¸¦ ¸¸µé±â·Î ÇÑ´Ù. ¿©±â¼ Áß¿äÇÑ Á¡Àº NameActDlg Ŭ·¡½º¿¡¼ ¸Þ¸ð¸®¸¦ delete ÇÑ´Ù. ±×·¯¸é
View Ŭ·¡½º¿¡¼ ´Ù½Ã m_pDlg¸¦ NULL·Î
¼±¾ðÇØ¾ß ÇÑ´Ù. ±×·¯³ª delete ÀÛ¾÷Àº NameActDlg Ŭ·¡½º¿¡¼ Çϰí m_pDlg´Â View Ŭ·¡½º¿¡ Á¸ÀçÇϱ⿡ À̸¦ ½ÇÇàÇϱâ À§Çؼ´Â delete ½Ã¿¡
¡°WM_DESTROY_DLG¡± ¸Þ½ÃÁö¸¦ View Ŭ·¡½º·Î
º¸³»°í ¸Þ½ÃÁö Çڵ鷯 ÇÔ¼ö¿¡¼ m_pDlg °´Ã¼ Æ÷ÀÎÅ͸¦ ÃʱâÈ Çϵµ·Ï ÇÑ´Ù. ´ÙÀ̾î·Î±× ¹Ú½º¿¡¼ [È®ÀÎ] Ãë¼Ò ¹öưÀ» ´õºí Ŭ¸¯ÇÏ¿© ¾Æ·¡¿Í °°Àº µÎ°³ÀÇ Çڵ鷯 ÇÔ¼ö¸¦ ¸¸µé°í ¾Æ·¡¿Í ÇÁ·Î±×·¥ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
void CNameActDlg::OnBnClickedOk() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. DestroyWindow(); return; OnOK(); } void CNameActDlg::OnBnClickedCancel() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. DestroyWindow(); return; OnCancel(); }
|
|
||||||||||||||||||||||||||||||||||||||||||
CNameActDlg Ŭ·¡½º¸¦ ¼±ÅÃÇÑ ÈÄ¿¡ ¡°¼Ó¼º¡±->¡±ÀçÁ¤ÀÇ¡±¿¡¼ ¾Æ·¡ ±×¸²°ú °°ÀÌ PostNcDestroy() ÇÔ¼ö¸¦ Ãß°¡ÇÑ´Ù. ±×¸®°í View Ŭ·¡½º·Î ¡°WM_DESTROY_DLG¡± ¸Þ½ÃÁö¸¦ Àü¼ÛÇÑ ÈÄ¿¡ delete ¿¬»êÀÚ¸¦
»ç¿ëÇÏ¿© ´ëÈ»óÀÚ¿¡ ÇÒ´çµÈ ¸Þ¸ð¸®¸¦ ¹ÝȯÇÑ´Ù.
ÇÁ·Î±×·¥¿¡ DialogTestDoc¿Í DialogTestView Ŭ·¡½º¸¦ include ÇÑ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
// NameActDlg.cpp : ±¸ÇöÆÄÀÏÀÔ´Ï´Ù. // #include "stdafx.h" #include "DialogTest.h" #include "NameActDlg.h" #include
"DialogTestDoc.h" #include
"DialogTestView.h" // =============== Áß°£ »ý·« ========================= void CNameActDlg::PostNcDestroy() { // TODO: ¿©±â¿¡Æ¯¼öȵÈÄڵ带Ãß°¡¹×/¶Ç´Â±âº»Å¬·¡½º¸¦È£ÃâÇÕ´Ï´Ù. CFrameWnd*
pWnd = (CFrameWnd*)AfxGetMainWnd(); CView*
pView = pWnd->GetActiveView(); pView->SendMessage(WM_DESTROY_DLG); delete
this; CDialog::PostNcDestroy(); }
|
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
¡°WM_DESTROY_DLG¡± ¸Þ½ÃÁö´Â Ç¥ÁØ À©µµ¿ì ¸Þ½ÃÁö°¡ ¾Æ´Ï¶ó »ç¿ëÀÚ Á¤ÀÇ ¸Þ½ÃÁö À̹ǷΠ¡°WM_USER¡± ¸Þ½ÃÁö¸¦ ÅëÇØ Á¤ÀÇ µÈ´Ù. ±×·¯¹Ç·Î À̸¦ ¡°stdafx.h¡± Çì´õ ÆÄÀÏ¿¡ Á¤ÀǸ¦ ÇØÁà¾ß ÇÑ´Ù.
|
||||||||||||||||||||||||||||||||||||||||||||
|
// stdafx.h : ÀÚÁÖ»ç¿ëÇÏÁö¸¸ÀÚÁÖº¯°æµÇÁö´Â¾Ê´Â // Ç¥ÁؽýºÅÛÆ÷ÇÔÆÄÀϹ×ÇÁ·ÎÁ§Æ®°ü·ÃÆ÷ÇÔÆÄÀÏÀÌ // µé¾îÀÖ´ÂÆ÷ÇÔÆÄÀÏÀÔ´Ï´Ù. #pragma once #ifndef _SECURE_ATL #define _SECURE_ATL 1 #endif //================== Áß°£»ý·« =========================== #include <afxwin.h>
// MFC Çٽɹ×Ç¥Áر¸¼º¿ä¼ÒÀÔ´Ï´Ù. #include <afxext.h>
// MFC È®ÀåÀÔ´Ï´Ù. #include <afxdisp.h> // MFC ÀÚµ¿ÈŬ·¡½ºÀÔ´Ï´Ù. #ifndef _AFX_NO_OLE_SUPPORT #include <afxdtctl.h> // Internet Explorer 4 °ø¿ëÄÁÆ®·Ñ¿¡´ëÇÑMFC Áö¿øÀÔ´Ï´Ù. #endif #ifndef _AFX_NO_AFXCMN_SUPPORT #include <afxcmn.h> // Windows °ø¿ëÄÁÆ®·Ñ¿¡´ëÇÑMFC Áö¿øÀÔ´Ï´Ù. #endif // _AFX_NO_AFXCMN_SUPPORT #define WM_DESTROY_DLG WM_USER+5 |
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
View Ŭ·¡½º¿¡¼ ±×¸²°ú °°ÀÌ ÇÔ¼ö Ãß°¡¸¦ ¼±ÅÃÇÑ ÈÄ¿¡
À©µµ¿ì ¸Þ½ÃÁö¸Ê¿¡ Á÷Á¢ ÄÚµùÇÑ´Ù.
¸Å°³º¯¼ö ¸ñ·ÏÀº ¡°¸Å°³º¯¼ö Çü½Ä¡±°ú ¡°¸Å°³º¯¼ö À̸§¡±À» ÀÔ·ÂÇÏ°í ¡°Ãß°¡¡± ¹öưÀ» ´©¸£¸é ¡°¸Þ°³º¯¼ö ¸ñ·Ï¡±¿¡ Ç¥½Ã µÈ´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
//================= Áß°£ »ý·« ===================================== // CDialogTestView IMPLEMENT_DYNCREATE(CDialogTestView, CView) BEGIN_MESSAGE_MAP(CDialogTestView, CView) // Ç¥ÁØÀμâ¸í·ÉÀÔ´Ï´Ù. ON_COMMAND(ID_FILE_PRINT,
&CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT,
&CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW,
&CView::OnFilePrintPreview) ON_COMMAND(ID_NAME_MODAL,
&CDialogTestView::OnNameModal) ON_COMMAND(ID_NAME_MODELESS,
&CDialogTestView::OnNameModeless) ON_MESSAGE(WM_DESTROY_DLG,
OnDestroyDlg) // WM_DESTROY_DLG ¸Þ½ÃÁöÇڵ鷯 END_MESSAGE_MAP() //================= Áß°£ »ý·« ===================================== LRESULT CDialogTestView::OnDestroyDlg(WPARAM wParam,
LPARAM lParam) { m_pDlg = NULL; return
LRESULT(); } |
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
´ëÈ»óÀÚ ±â´É ±¸Çö |
||||||||||||||||||||||||||||||||||||||||||||
¼¼»ç¶÷À» ¼±ÅÃÇÏ´Â ¶óµð¿À¹öưÀ» ´©¸£¸é
SetName(int nButton) ÇÔ¼ö¸¦ ½ÇÇàÇÏ¿© EditBox¿¡ À̸§À» Ç¥½ÃÇϰí Doc Ŭ·¡½ºÀÇ m_Name ¿¡ ±× °ªÀ» ÀúÀå Çϵµ·Ï ÇϰڽÀ´Ï´Ù.
|
||||||||||||||||||||||||||||||||||||||||||||
NameActDlg Ŭ·¡½º¿¡ ¾Æ·¡¿Í °°ÀÌ ÇÔ¼ö¸¦ Ãß°¡ÇÑ´Ù.
|
||||||||||||||||||||||||||||||||||||||||||||
|
void CNameActDlg::SetName(int
nButton) { CString str; switch(nButton)
{ case
0: str.Format("¹ÚÅÂÁذª=%d",nButton); break; case
1: str.Format("Ç㸸±Ç°ª=%d",nButton); break; case
2: str.Format("ÀÌ»ó¿ë°ª=%d",nButton); break; } SetDlgItemText(IDC_NAME,
str); UpdateData(FALSE); //Doc
Ŭ·¡½º·Î°ªÀ»ÀúÀå CFrameWnd*
pWnd = (CFrameWnd*)AfxGetMainWnd(); ((CDialogTestDoc*)pWnd->GetActiveDocument())->m_Name
= nButton; } void CNameActDlg::OnBnClickedPark() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(0); } void CNameActDlg::OnBnClickedHuh() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(1); } void CNameActDlg::OnBnClickedLee() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(2); } |
|
||||||||||||||||||||||||||||||||||||||||||
´ÙÀ̾î·Î±× ¹Ú½º°¡¸¦ ½ÃÀÛÇÒ ¶§
Doc Ŭ·¡½º¿¡ ÀúÀåµÇ¾î ÀÖ´Â ÃʱâÄ¡¸¦ Ç¥½ÃÇÏ´Â ÇÁ·Î±×·¥À» ÇϰڽÀ´Ï´Ù. [NameActDlg Ŭ·¡½º->¼Ó¼º->ÀçÁ¤ÀÇ]¿¡¼ ¡°OnInitDialog¡± ÇÔ¼ö¸¦ ¼±Åà ÇÕ´Ï´Ù.
¶óµð¿À ¹öưÀº Modal ¿¡¼¿Í µ¿ÀÏÇÏ°Ô ÁöÁ¤ ÇÕ´Ï´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
|
void CNameActDlg::SetName(int
nButton) { CString str; switch(nButton)
{ case
0: str.Format("¹ÚÅÂÁذª=%d",nButton); break; case
1: str.Format("Ç㸸±Ç°ª=%d",nButton); break; case
2: str.Format("ÀÌ»ó¿ë°ª=%d",nButton); break; } SetDlgItemText(IDC_NAME,
str); m_Name
= nButton; UpdateData(FALSE); //Doc
Ŭ·¡½º·Î°ªÀ»ÀúÀå CFrameWnd*
pWnd = (CFrameWnd*)AfxGetMainWnd(); ((CDialogTestDoc*)pWnd->GetActiveDocument())->m_Name
= nButton; } void CNameActDlg::OnBnClickedPark() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(0); } void CNameActDlg::OnBnClickedHuh() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(1); } void CNameActDlg::OnBnClickedLee() { // TODO: ¿©±â¿¡ÄÁÆ®·Ñ¾Ë¸²Ã³¸®±âÄڵ带Ãß°¡ÇÕ´Ï´Ù. SetName(2); } BOOL CNameActDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ¿©±â¿¡Ãß°¡ÃʱâÈÀÛ¾÷À»Ãß°¡ÇÕ´Ï´Ù. CFrameWnd* pWnd =
(CFrameWnd*)AfxGetMainWnd(); SetName(((CDialogTestDoc*)pWnd->GetActiveDocument())->m_Name); return TRUE;
// return TRUE unless you set the focus to a
control // ¿¹¿Ü: OCX ¼Ó¼ºÆäÀÌÁö´ÂFALSE¸¦¹ÝÈ¯ÇØ¾ßÇÕ´Ï´Ù. } |
|
||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
°ú Á¦ |
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||