magicsonic
驱动牛犊
驱动牛犊
  • 注册日期2005-01-19
  • 最后登录2005-08-02
  • 粉丝0
  • 关注0
  • 积分6分
  • 威望2点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1605回复:5

[询问]关于MFC编程里面的AFX应用

楼主#
更多 发布于:2005-08-01 04:47
  小弟急....毕业设计明天就要答辩了,有些东西还没弄清楚.谁能帮帮我?感激不尽!~~

//{{AFX_DATA()
      CComboBox m_LlistLogSize;
       .................
//}}AFX_DATA

请问//{{AFX_DATA 为什么要用2个'/'和2个'{'啊??而且'CComboBox m_LlistLogSize;'的颜色也变成了灰色(照例应该是黑色啊)


还有AFX_DATA,AFX_MSG,AFX_VIRTUAL有什么区别啊?
MSDN里面找半天找不到,看到一个AFX,看半天也没觉得它说明白
BreaKing
驱动牛犊
驱动牛犊
  • 注册日期2004-09-25
  • 最后登录2006-06-05
  • 粉丝0
  • 关注0
  • 积分41分
  • 威望5点
  • 贡献值0点
  • 好评度4点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2005-08-01 14:32
下面是引用magicsonic于2005-08-01 04:47发表的[询问]关于MFC编程里面的AFX应用:
  小弟急....毕业设计明天就要答辩了,有些东西还没弄清楚.谁能帮帮我?感激不尽!~~

//{{AFX_DATA()
      CComboBox m_LlistLogSize;
       .................
.......

这些都是MFC的东东,VC靠它们来辨别哪些东东是自己的
用心!
笑傲糨糊
驱动牛犊
驱动牛犊
  • 注册日期2004-06-08
  • 最后登录2007-10-17
  • 粉丝0
  • 关注0
  • 积分49分
  • 威望10点
  • 贡献值0点
  • 好评度9点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2005-08-01 17:36
AFX_DATA
Remarks

ClassWizard and AppWizard insert specially formatted comment delimiters in your source code files to mark the places in your files that ClassWizard can write to. AFX_DATA is used to mark the beginning and end of member variable declarations in your header file (.H) used for dialog data exchange (DDX):
//{{AFX_DATA(classname)
...
//}}AFX_DATA



AFX_MSG
Remarks

ClassWizard and AppWizard insert specially formatted comment delimiters in your source code files to mark the places in your files that ClassWizard can write to. AFX_MSG is used to mark the beginning and end of ClassWizard entries in your header file (.H) related to message maps:
//{{AFX_MSG(classname)
...
//}}AFX_MSG



AFX_VIRTUAL
Remarks

ClassWizard and AppWizard insert specially formatted comment delimiters in your source code files to mark the places in your files that ClassWizard can write to. AFX_VIRTUAL is used to mark the beginning and end of virtual function override declarations in a class’s header (.H) file:

//{{AFX_VIRTUAL(classname)
...
//}}AFX_VIRTUAL

There is no corresponding ClassWizard section in the .CPP file.
笑傲糨糊
驱动牛犊
驱动牛犊
  • 注册日期2004-06-08
  • 最后登录2007-10-17
  • 粉丝0
  • 关注0
  • 积分49分
  • 威望10点
  • 贡献值0点
  • 好评度9点
  • 原创分0分
  • 专家分0分
地板#
发布于:2005-08-01 17:41
ClassWizard: Special-Format Comment Sections
Home |  Overview |  How Do I | Tutorial

This article explains where and how ClassWizard edits your source files.

When you add a new class using ClassWizard, special-format comments are placed in your code to mark the sections of the header and implementation files that ClassWizard edits. ClassWizard never modifies code that is outside these commented sections.

ClassWizard creates the following types of comments in your code:

Message-Map Comments


Virtual Function Comments


Data Map Comments


Field Map Comments


Active Dispatch Map Comments
Message-Map Comments
For most classes, there are two related sections of code that ClassWizard edits: the member-function definitions in the class header file and the message-map entries in the class implementation file.

The ClassWizard comments in the header file look like this:

//{{AFX_MSG(<classname>)
  afx_msg void OnAppAbout();
//}}AFX_MSG

The ClassWizard section in the implementation file is set off with comments that look like this:

//{{AFX_MSG_MAP(<classname>)
  ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
//}}AFX_MSG_MAP

The notes in the ClassWizard section act as placeholders. ClassWizard removes the note from any ClassWizard section in which it writes code.

Virtual Function Comments
As with message handlers, ClassWizard writes code to two locations when you use it to override a virtual function in one of your classes.

The ClassWizard comments in the header file look like the following example for virtual function overrides:

//{{AFX_VIRTUAL(<classname>)
  virtual BOOL InitInstance();
//}}AFX_VIRTUAL

The ClassWizard section in the implementation file has no special comments. Virtual function definitions in the .cpp file look like other function definitions.

Data Map Comments
For dialog boxes, form views, and record views, ClassWizard creates and edits three other sections that are marked with special format comments:

Member variable declarations in the class header file:
//{{AFX_DATA
..
//}}AFX_DATA

Member variable initialization in the class implementation file:
//{{AFX_DATA_INIT
..
//}}AFX_DATA_INIT

Data-exchange macros in the implementation file:
//{{AFX_DATA_MAP
..
//}}AFX_DATA_MAP

Field Map Comments
For record field exchange, ClassWizard creates and edits three other sections that are marked with special format comments:

Member variable declarations in the class header file:
//{{AFX_FIELD
..
//}}AFX_FIELD

Record exchange function calls in the implementation file:
//{{AFX_FIELD_MAP
..
//}}AFX_FIELD_MAP

Member variable initializations in the class header file:
//{{AFX_FIELD_INIT
..
//}}AFX_FIELD_INIT

Active Dispatch Map Comments
For Active method dispatch, ClassWizard creates and edits four other sections that are marked with special format comments:

Active events in the class header file:
//{{AFX_EVENT
..
//}}AFX_EVENT

Active events in the class implementation file:
//{{AFX_EVENT_MAP
..
//}}AFX_EVENT_MAP

Automation declarations in the class header file:
//{{AFX_DISP
..
//}}AFX_DISP

Automation mapping in the class implementation file:
//{{AFX_DISP_MAP
..
//}}AFX_DISP_MAP
笑傲糨糊
驱动牛犊
驱动牛犊
  • 注册日期2004-06-08
  • 最后登录2007-10-17
  • 粉丝0
  • 关注0
  • 积分49分
  • 威望10点
  • 贡献值0点
  • 好评度9点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2005-08-01 17:42
AFX表示微软的Application Framework开发团队吧!X没什么意义,好象哪本书上讲过
magicsonic
驱动牛犊
驱动牛犊
  • 注册日期2005-01-19
  • 最后登录2005-08-02
  • 粉丝0
  • 关注0
  • 积分6分
  • 威望2点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2005-08-02 01:38
Thank you very much!I don't know how to appreciate your help!Thank you,you are so kindly:)
游客

返回顶部