2010년 1월 20일 수요일

MFC practice #1

from HCI MFC tool development project.


1st MFC Example(p.74) - Create() method Usage.
1. CCreateDemoView example

2. create new window class named "CButton".
    starting coordinates(50,50) and width,height is 200,100 respectively.
3. create another child window which has property of "CEdit",
    so that you can see two child windows in a view window.

procedure>>
 1. open xxView.h file. add 'CWnd' class object in the CxxView class like below.
public:
CWnd m_wndChild;
 2. 'Class View' tab, see property window of 'CxxView' class.
     -click 'Messages' box.
     -among the various messages, find 'WM_CREATE',
      then register 'OnCreate()' message handler function.(use drop down menu)
     -'xxView.cpp' file is open, and some code(OnCreate()) is added in it automatically.
 3. Add your own code in the above 'OnCreate' function like below.
        // TODO:  Add your specialized creation code here
m_wndChild.Create(TEXT("Button"),TEXT("DEMO"),
                                     WS_CHILD|WS_VISIBLE|WS_BORDER,
                                     CRect(50,50,250,150),this,1234);
 4. To create another child window in the same parent window,
     add another 'CWnd' class object which has a different name of the previous one like below.
         public:
CWnd m_wndChild;
CWnd m_wndChild2;
  5. add your own acting code in the 'OnCreate' function in the same way of #3.
// TODO:  Add your specialized creation code here
m_wndChild.Create(TEXT("Button"),TEXT("DEMO"),
     WS_CHILD|WS_VISIBLE|WS_BORDER,
     CRect(50,50,250,150),this,1234);
m_wndChild2.Create(TEXT("EDIT"),TEXT("DEMO"),
      WS_CHILD|WS_VISIBLE|WS_BORDER,
      CRect(50,160,250,260),this,1234);
  6. you can see a result like below window.



  7. simple HCI GUI model with no function by using above procedure.


댓글 없음:

댓글 쓰기