MFC 메뉴 활성화와 비활성화
//===========================================================================
class CMainFrame : public CFrameWnd
{
protected: // serialization에서만 만들어집니다.
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// 특성입니다.
public:
// 작업입니다.
public:
BOOL Id_Menu_Flag;
// 재정의입니다.
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 구현입니다.
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // 컨트롤 모음이 포함된 멤버입니다.
CToolBar m_wndToolBar;
CStatusBar m_wndStatusBar;
// 생성된 메시지 맵 함수
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnUpdateMenuStart(CCmdUI *pCmdUI);
afx_msg void OnUpdateMenuStop(CCmdUI *pCmdUI);
afx_msg void OnMenuStart();
afx_msg void OnMenuStop();
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
virtual BOOL PreTranslateMessage(MSG* pMsg);
};
//=========================================================================
void CMainFrame::OnMenuStart()//메세지 핸들러
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
AfxMessageBox(_T("OnMenuStart 시작"));
Id_Menu_Flag = FALSE;
}
void CMainFrame::OnMenuStop()//메세지 핸들러
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
AfxMessageBox(_T("OnMenuStart 종료"));
Id_Menu_Flag = TRUE;
}