void CMainFrame::OnUpdateFileNew(CCmdUI *pCmdUI)
{
static int m=1;
if(1==m) AfxMessageBox(L"第一次进入OnUpdateFileNew",MB_OK,0);
if(2==m) AfxMessageBox(L"第二次进入OnUpdateFileNew",MB_OK,0);
if(3==m) AfxMessageBox(L"第三次进入OnUpdateFileNew",MB_OK,0);
if(4==m) AfxMessageBox(L"第四次进入OnUpdateFileNew",MB_OK,0);
.....
pCmdUI->Enable(Cnt);
++m;
}解释:
一运行
第一步:出现对话框:第一次进入OnUpdateFileNew 点击OK
第二步:出现窗口同时并且出现对话框:第二次进入OnUpdateFileNew 点击OK
第三步:出现对话框:第三次进入OnUpdateFileNew 点击OK
第四步:出现对话框:第四次进入OnUpdateFileNew 点击OK
。
第n步:出现对话框:第n次进入OnUpdateFileNew 点击OK
{
static int m=1;
if(1==m) AfxMessageBox(L"第一次进入OnUpdateFileNew",MB_OK,0);
if(2==m) AfxMessageBox(L"第二次进入OnUpdateFileNew",MB_OK,0);
if(3==m) AfxMessageBox(L"第三次进入OnUpdateFileNew",MB_OK,0);
if(4==m) AfxMessageBox(L"第四次进入OnUpdateFileNew",MB_OK,0);
.....
pCmdUI->Enable(Cnt);
++m;
}解释:
一运行
第一步:出现对话框:第一次进入OnUpdateFileNew 点击OK
第二步:出现窗口同时并且出现对话框:第二次进入OnUpdateFileNew 点击OK
第三步:出现对话框:第三次进入OnUpdateFileNew 点击OK
第四步:出现对话框:第四次进入OnUpdateFileNew 点击OK
。
第n步:出现对话框:第n次进入OnUpdateFileNew 点击OK
这样解释可以了?