jiangsheng

http://www.csdn.net/develop/author/netauthor/jiangsheng/
随笔 - 142, 评论 - 629, 引用 - 27

导航

关于

 
这下要维护3个BLOG了,faint 其他的地址:

所有的文章版权归原文作者所有,任何人需要转载文章,必须征得原文作者授权。
我的MVP配置

标签

每月存档

最新留言

广告

Javascript写的星际?

http://www.openlab.com.cn/~comy/jsscV1.0/sc.htm

?

posted on 2004-05-27 05:37:00 by jiangsheng  评论(26) 阅读(5175)

偶然发现的,可能很多人都知道的技巧了

系统的消息框的内容是可以复制的,弹出来的时候按Ctrl C就可以复制到剪贴板了。这估计会很大程度上减少技术支持人员的电话费用。

---------------------------
移动文件或文件夹时出错
---------------------------
无法移动 Q266318 HOWTO Retrieve the Name of an Office Document That Contains an MFC ActiveX Control.url: 源文件名和目标文件名相同。
---------------------------
确定  
---------------------------

在自己写的程序里面写这样的代码似乎也不困难。


最新在做VC常见问题的整理工作,键盘有几个键坏掉了,不得不用软键盘...

posted on 2004-05-25 18:22:00 by jiangsheng  评论(11) 阅读(2962)

今天在搜MSDN的时候不小心打错一个字

把WM_DESTROY 打成了WM_DESTORY ,然后发现MSDN里面也打错一个字,嘿嘿

话说回来,粗心的人也不止我一个。上Google的搜索结果是

约有 91 项符合WM_DESTORY 的查询结果,以下是第 21 - 30 项。 (搜索用时 0.19 秒)?

最近打文章打得太多,键盘有几个键坏掉了...软键盘为什么只有标准打字机的键...

随笔里面的一段评论

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig!

posted on 2004-05-18 13:22:00 by jiangsheng  评论(7) 阅读(2345)

MSDN China改版之后...

我的一些书签打开之后就成了这样子

很抱歉, microsoft.com 没有合乎您要求的网页。

您输入的地址可能不正确,或者该网页并不存在.

这不是问题,问题是在站里面找不到文章的新位置了,没有办法更新书签。

好在百度还有快照

http://cache.baidu.com/c?word=%B2%F0%3B%C8%A1%2Cweb%2C%D2%B3&url=http%3A//207%2E46%2E245%2E92/china/msdn/workshop/scrape%2Easp&b=12&user=baidu

posted on 2004-05-14 14:09:00 by jiangsheng  评论(8) 阅读(2547)

对话框数据交换(MFC)

    //{{Jiangsheng的牢骚(对话框数据交换)
由于越来越多的人问如何在对话框中获得文档/视图指针以执行数据访问和交换的问题,我大多数情况下都不得不建议比较好的方式是备份数据而不是直接修改。

    本文的内容以现状提供并且不提供任何担保,Jiangsheng不对使用本文造成的可能的损失负责
    //}}End Jiangsheng的牢骚(对话框数据交换)

通常,简单的对话框不使用结构来存储成员数据。但是大量的简单类型的成员交换会使得代码繁琐。这时候可以使用结构来封装简单类型的数据,声明一个赋值操作符和修改DDX调用来简化数据交换代码。

例如在文档或者视图的命令处理函数中
void CMyView::OnSomeButton()
{
    CMyDoc* pDoc=GetDocument();
    CMyDialog mydlg;
    mydlg.m_data=pDoc->data1;
    if(mydlg.DoModal()!=IDOK)return;//Allow cancel
    pDoc->data1=mydlg.m_data;
}

void CMyDialog::DoDataExchange(CDataExchange* pDX)
{
    CDialog::DoDataExchange(pDX);    // call base class
    //{{AFX_DATA_MAP(CMyDialog)
    //}}AFX_DATA_MAP
    DDX_Check(pDX, IDC_SEX, m_data.m_bFemale);
    DDX_Text(pDX, IDC_EDIT1, m_data.m_strName);
}

这里pDoc->data1和mydlg.m_data不必是同一类型的类,只需要有=操作符来复制数据就行了。

我要把文档的数据复制一个备份的原因是,如果在模态对话框中把控件直接绑定到文档的成员,那么如果在对话框数据验证过程中一个控件验证失败,那么验证过程中这个控件之前的数据交换已经执行,即使选择取消之后也无法恢复弹出对话框之前的状态。这可能不是用户期望的行为。

另外,基于MFC的句柄映射机制,跨线程调用CWnd成员函数,例如UpdateData,会有不可预料的后果。有兴趣的可以参考微软知识库文章Q147578 CWnd Derived MFC Objects and Multi-threaded Applications。

修改工程的CLW文件以扩展默认的DDX/DDV机制的方法对我不很实用。我的VC经常丢失部分类的向导信息(在存盘的时候,我的杀毒软件就隔离了我的代码文件开始扫描病毒,然后VC报告文件不能保存,classview的相关类信息就丢失了)我不得不每隔一段时间删除并且重建CLW文件。

顺便说一下,TN026里面似乎有好多BUG,被解释了两次,根据顺序来看,第一个解释应该是正确的。第二个似乎是旧的解释的版本,忘记删除了。看起来看MFC技术文章的人次是不多...

http://www.microsoft.com/china/community/content/news/mstranslate.aspx里面的链接似乎都是死链接?

这里是我以前写的一个自定义的DDX的代码。

posted on 2004-05-14 11:33:00 by jiangsheng  评论(4) 阅读(4418)

对话框数据交换

??? //{{Jiangsheng的垃圾代码(对话框数据交换)
class?CDataTypeFieldExChange;
//CTextFieldEdit是一个派生于CEdit,绑定到记录集字段的编辑框
//lpszFieldName是绑定的字段的名称
//vt是绑定的字段的类型

void ?DDX_TextField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl,LPCTSTR lpszFieldName,VARTYPE

vt=VT_BSTR);

//DDX_TextField的封装;自动从数据类型获取字段名称:描述/别名/标识字段;并且有简单的验证

void ?DDX_InfoField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl);
void ?DDX_AliasField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl);
void ?DDX_IDField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl);

void DDX_AliasField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl)
{
?DDX_TextField(pDX,nIDC,rControl,pDX->m_pDTC->m_pDataType->m_strAliasField);
?switch(pDX->m_pDTC->m_adReason){
?case?adRsnAddNew:
?case?adRsnUpdate:
?case?adRsnDelete:
??if(pDX->m_pDX->m_bSaveAndValidate){
???CString strText;
???rControl.GetWindowText(strText);
???if(strText.FindOneOf(T("/\\*?[]\"<>失望的脸"))!=-1){
????CString strTemp;
????strTemp.Format(_T("%s不能包含以下字符: / \\ * ? [ ] \" < > : |")
?????,pDX->m_pDTC->m_pDataType->m_strAliasField);
????::AfxMessageBox(strTemp);
????pDX->m_pDX->Fail();
???}
??}
?}
}

void DDX_IDField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit&? rControl)
{
?if(pDX->m_pDX->m_bSaveAndValidate){
??TRACE_LINE(_T("Ignore DDX for %s/%s")
???,pDX->m_pDTC->m_pDataType->m_strDataType
???,pDX->m_pDTC->m_pDataType->m_strIDField
???眨眼笑脸;
?}
?else{
??DDX_TextField(pDX,nIDC,rControl,pDX->m_pDTC->m_pDataType->m_strIDField);
?}
}

void DDX_InfoField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl)
{
?DDX_TextField(pDX,nIDC,rControl,pDX->m_pDTC->m_pDataType->m_strInfoField);
?switch(pDX->m_pDTC->m_adReason){
?case?adRsnAddNew:
?case?adRsnUpdate:
?case?adRsnDelete:
??if(pDX->m_pDX->m_bSaveAndValidate){
???CString strText;
???rControl.GetWindowText(strText);
???if(strText.IsEmpty()){
????CString strTemp;
????strTemp.Format(_T("%s不能为空!"),pDX->m_pDTC->m_pDataType->m_strInfoField);
????::AfxMessageBox(strTemp);
????pDX->m_pDX->Fail();
???}
???if(strText.FindOneOf(T("/\\*?[]\"<>失望的脸"))!=-1){
????CString strTemp;
????strTemp.Format(_T("%s不能包含以下字符: / \\ * ? [ ] \" < > : |",pDX->m_pDTC->m_pDataType-

>m_strInfoField));
????::AfxMessageBox(strTemp);
????pDX->m_pDX->Fail();
???}

??}
??else{
???if(!pDX->m_pDTC->m_strAddNew.IsEmpty()){
????rControl.SetWindowText(pDX->m_pDTC->m_strAddNew);
???}
??}
?}
}

void DDX_TextField(CDataTypeFieldExChange* pDX
???? , int nIDC
???? , CTextFieldEdit& rControl
???? ,LPCTSTR lpszFieldName
???? ,VARTYPE vt//=VT_BSTR
)
{
?FieldsPtr?pFields=pDX->m_pRecordset->Fields;
?CString strFieldName(lpszFieldName);
?CDataType* pDT=pDX->m_pDTC->m_pDataType;

?CString strVal;
?if (!pDX->m_pDX->m_bSaveAndValidate){
??switch(pDX->m_pDTC->m_adReason){
??case?adRsnAddNew:
??case?adRsnUpdate:
??case?adRsnDelete:
???if(!strFieldName.IsEmpty()){
????strVal=g_GetValueString(pFields->Item[lpszFieldName]->Value);
???}
???else{
????ASSERT(FALSE);
???}

??}
?}
?DDX_Control(pDX->m_pDX,nIDC,rControl);
?DDX_Text(pDX->m_pDX,nIDC,strVal);

?if(pDX->m_pDX->m_bSaveAndValidate){
??switch(pDX->m_pDTC->m_adReason){
??case?adRsnAddNew:
??case?adRsnUpdate:
??case?adRsnDelete:
???{
????_variant_t varVal;
????if(g_SetValueString(varVal,strVal,vt)){
?????TRACE_LINE(_T("Set Field %s to %s\n"),lpszFieldName,strVal);
?????if(!strFieldName.IsEmpty()){
??????pFields->Item[lpszFieldName]->Value=varVal;
?????}
?????else{
??????ASSERT(FALSE);
?????}
????}
???}
??}
?}
?else{
??//编辑框的前一个控件是其标题,其文字从数据库中的类型定义获得
??CWnd* pStatic=rControl.GetNextWindow(GW_HWNDPREV);
??CString strCaption=pDT->GetFieldProperty(lpszFieldName,_T("Caption"));
??if(pStatic&&!strCaption.IsEmpty()){
???pStatic->SetWindowText(strCaption);
??}
??rControl.SetClientTipText(pDT->GetFieldProperty(lpszFieldName,_T("Comments")));
?}

}
??? //}}End Jiangsheng的垃圾代码(对话框数据交换)

附我的翻译

http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfcnotes_tn026.asp

TN026: DDX and DDV Routines
技术文章026 DDX 和DDV 程序

This note describes the dialog data exchange (DDX) and dialog data validation (DDV) architecture. It also describes how you

write a DDX_ or DDV_ procedure and how you can extend ClassWizard to use your routines.
本文描述对话框数据交换(DDX)和对话框数据验证(DDV)架构。它也描述了你如何编写一个DDX_ 或者 DDV_ 过程,以及如何扩展类向导来使用你

的程序。

Overview of Dialog Data Exchange
对话框数据交换概述

All dialog data functions are done with C++ code. There are no special resources or magic macros. The heart of the mechanism

is a virtual function that is overridden in every dialog class that does dialog data exchange and validation. It is always

found in this form:
所有的对话框数据函数都是用C++实现的。没有特殊的资源或者魔法宏。机制的核心是一个在每一个对话框类中重载的函数,执行对话框数据交

换和验证。它总是由这种形式组成

void CMyDialog:咧嘴笑脸oDataExchange(CDataExchange* pDX)
{
??? CDialog:咧嘴笑脸oDataExchange(pDX);??? // call base class

??? //{{AFX_DATA_MAP(CMyDialog)
???????
???????
??? //}}AFX_DATA_MAP
}

The special format AFX comments allow ClassWizard to locate and edit the code within this function. Code that is not

compatible with ClassWizard should be placed outside of the special format comments.
这个特殊格式的AFX注释允许类向导在函数中定位和编辑代码。和类向导不兼容的代码应该放在特殊格式的注释之外。

In the above example, is in the form:
在上面的例子中,<数据交换函数调用>是如下形式

??? DDX_Custom(pDX, nIDC, field);

and is optional and is in the form:
而且<数据验证函数调用>是可选的,并且是如下形式
??? DDV_Custom(pDX, field, ...);

More than one DDX_/DDV_ pair may be included in each DoDataExchange function.
每一个DoDataExchange函数可能包含多于一个的DDX_/DDV_对。

See 'afxdd_.h' for a list of all the dialog data exchange routines and dialog data validation routines provided with MFC.
察看'afxdd_.h'以获得一个所有MFC提供的对话框数据交换程序和对话框数据验证程序的列表。

Dialog data is just that - member data in the CMyDialog class. It is not stored in a struct or anything special like that.
对话框数据只是CMyDialog的数据成员。他不存储在一个结构或者类似的东西中。

Notes
注意事项

Although we call this “dialog data,” all features are available in any class derived from CWnd and are not limited to just

dialogs.
虽然我们称之为“对话框数据”,但是所有特性在任一CWnd派生类中都存在,不仅限于对话框。

Initial values of data are set in the standard C++ constructor, usually in a block with //{{AFX_DATA_INIT and //}}

AFX_DATA_INIT comments.
数据的初始值是在标准C++构造函数中设置的,通常是在一个//{{AFX_DATA_INIT和//}}AFX_DATA_INIT注释块里面。

CWnd::UpdateData is the operation that does the initialization and error handling around the call to DoDataExchange.
CWnd::UpdateData是执行初始化和调用DoDataExchange中的错误处理的操作。

You can call CWnd::UpdateData at any time to perform data exchange and validation. By default UpdateData(TRUE) is called in

the default CDialog::OnOK handler and UpdateData(FALSE) is called in the default CDialog::OnInitDialog.
你可以在任何时候调用CWnd::UpdateData来执行数据的交换或者验证。

The DDV_ routine should immediately follow the DDX_ routine for that field.
DDV_ 程序应该紧跟着相关域的DDX_程序。

How Does It Work?
它是如何工作的?

You do not need to understand the following in order to use dialog data. However, understanding how this works behind the

scenes will help you write your own exchange or validation procedure.
你不需要理解下文以使用对话框数据。但是,理解它的幕后工作原理将帮助你编写你自己的教换或者验证程序。

The DoDataExchange member function is much like the Serialize member function - it is responsible for getting or setting data

to/from an external form (in this case controls in a dialog) from/to member data in the class. The pDX parameter is the

context for doing data exchange and is similar to the CArchive parameter to CObject:困惑的笑脸erialize. The pDX (a CDataExchange

object) has a direction flag much like CArchive has a direction flag:
DoDataExchange 成员函数很像Serialize 成员函数-它负责数据成员到/从一个外部格式获取或者设置数据(在这种情况下是在一个对话框中)。

PDX参数是数据交换的上下文,而且类似CObject:困惑的笑脸erialize的CArchive参数。就像CArchiv有一个方向标志一样,pDX 也有一个方向标志:

??? if !m_bSaveAndValidate, then load the data state into the controls
??? 如果!m_bSaveAndValidate为真,那么载入数据状态到控件

??? if m_bSaveAndValidate, then set the data state from the controls
??? 如果m_bSaveAndValidate为真,那么根据控件状态设置数据

Validation only occurs when m_bSaveAndValidate is set. The value of m_bSaveAndValidate is determined by the BOOL parameter to

CWnd::UpdateData.
验证只在m_bSaveAndValidate设置了之后进行。m_bSaveAndValidate的值是由CWnd::UpdateData的BOOL参数决定的。

There are three other interesting CDataExchange members:
另外还有一些有趣的CDataExchange成员:

m_pDlgWnd: The window (usually a dialog) that contains the controls. This is to prevent callers of the DDX_ and DDV_ global

functions from having to pass 'this' to every DDX/DDV routine.
包含控件的窗口(通常是一个对话框).这避免了全局的DDX_和DDV_函数不得不传递'this'到每一个DDX/DDV程序。

PrepareCtrl, and PrepareEditCtrl: Prepares a dialog control for data exchange. Stores that control's handle for setting the

focus if a validation fails. PrepareCtrl is used for nonedit controls and PrepareEditCtrl is used for edit controls.
PrepareCtrl和PrepareEditCtrl:为数据交换准备一个对话框控件。保存控件的句柄以在验证失败的时候设置焦点。PrepareCtrl 用于非编辑控

件,而PrepareEditCtrl用于编辑控件。

Fail: Called after bringing up a message box alerting the user to the input error. This routine will restore the focus to the

last control (the last call to PrepareCtrl/PrepareEditCtrl) and throw an exception. This member function may be called from

both DDX_ and DDV_ routines.
User Extensions

Fail:在显示一个消息框提示用户输入错入之后调用。这个程序将恢复焦点到最后的控件(最后一个调用PrepareCtrl/PrepareEditCtrl的)并且

抛出一个异常。这个成员在DDX_和DDV_程序中都可以调用。

There are several ways to extend the default DDX/DDV mechanism. You can:
有很多种方式来扩展默认的DDX/DDV机制。你可以:

Add new data types.
增加新的数据类型

CTime

Add new exchange procedures (DDX_???).
添加新的交换过程(DDX_???).

void PASCAL DDX_Time(CDataExchange* pDX, int nIDC, CTime& tm);

Add new validation procedures (DDV_???).
和新的验证过程(DDV_???).

void PASCAL DDV_TimeFuture(CDataExchange* pDX, CTime tm, BOOL bFuture);

// make sure time is in the future or past
确保时间是未来或者过去的

Pass arbitrary expressions to the validation procedures.
传递绝对的表达式到验证过程

DDV_MinMax(pDX, age, 0, m_maxAge);

Note?? Such arbitrary expressions cannot be edited by ClassWizard and therefore should be moved outside of the special format

comments (//{{AFX_DATA_MAP(CMyClass)).
注意,这些绝对的表达式不能被类向导编辑,因此应该被移出特殊格式的注释(//{{AFX_DATA_MAP(CMyClass))

Have the DoDialogExchange member function include conditionals or any other valid C++ statements with intermixed exchange and

validation function calls.
使DoDialogExchange 成员函数包含混合交换和验证函数调用的条件或者其它任何合法C++语句。

//{{AFX_DATA_MAP(CMyClass)
DDX_Check(pDX, IDC_SEX, m_bFemale);
DDX_Text(pDX, IDC_EDIT1, m_age);
//}}AFX_DATA_MAP
if (m_bFemale)
??? DDV_MinMax(pDX, age, 0, m_maxFemaleAge);
else
??? DDV_MinMax(pDX, age, 0, m_maxMaleAge);

Note?? As shown above, such code can not be edited by ClassWizard and should be used only outside of the special format

comments.
注意,如上所述,这样的代码不能被类向导编辑,因此应该被移出特殊格式的注释。

ClassWizard Support
类向导支持

ClassWizard supports a subset of DDX/DDV customizations by allowing you to integrate your own DDX_ and DDV_ routines into the

ClassWizard user interface. Doing this is only cost beneficial if you plan to reuse particular DDX and DDV routines time and

time again in a project or in many projects.
类向导允许你集成你自己的DDX_ 和DDV_程序到类向导用户界面中以支持自定义DDX/DDV的一个子集。这只在你计划在一个或者多个工程中重复

使用特定DDX_ 和DDV_程序的时候有好处。

To do this, special entries are made in DDX.CLW (previous versions of Visual C++ stored this information in APSTUDIO.INI) or

in your project’s .CLW file. The special entries can be entered either in the [General Info] section of your project's .CLW

file or in the [ExtraDDX] section of the DDX.CLW file in the \Program Files\Microsoft Visual Studio\Visual C++\bin directory.

You may need to create the DDX.CLW file if it doesn’t already exist. If you plan to use the custom DDX_/DDV_ routines only

in a certain project, add the entries to the [General Info] section of your project .CLW file instead. If you plan to use the

routines on many projects, add the entries to the [ExtraDDX] section of DDX.CLW.

要完成这个功能,必须在DDX.CLW(以前版本的Visual C++在APSTUDIO.INI中保存这个信息) 或者你的工程的.CLW文件中添加特殊条目。特殊条目可以添加在你的工程的.CLW文件的[General Info]节下面,或者\Program Files\Microsoft Visual Studio\Visual C++\bin目录中的DDX.CLW文件的[ExtraDDX]节下面。如果DDX.CLW文件不存在,你可能需要创建它.如果你只计划在特定的工程中使用自定义的DDX_/DDV_程序,则特殊条目添加到你的工程的.CLW文件的[General Info]节下面。如果你计划在很多工程中使用(自定义的DDX_/DDV_) 程序,则添加到DDX.CLW文件的[ExtraDDX]节下面

The general format of these special entries is:
这些特殊条目的通常形式是:

ExtraDDXCount=n

; where n is the number of ExtraDDX? lines to follow
这里是下面的ExtraDDX?的行数
ExtraDDX?=;; ; ; ; [;; ; ; [; ]]

; Where ? is a number 1-n indicating which DDX type in the list that is being defined.
这里?是一个1到n的数字表示定义的DDX类型在列表中的序号

Each field is delimited by a ';' character. The fields and their purpose are described below.
每个域以';'字符分割。域及其作用如下所述。

=指名此变体类型允许何种对话框控件的单字符列表
E = edit
E = 编辑框

C = two-state check box
C = 二态复选框

c = tri-state check box
c = 三态复选框

R = first radio button in a group
R = 组中首个选项按钮

L = non-sorted list box
L = 未排序列表框

l = sorted list box
l = 排序列表框

M = combo box (with edit item)
M = 可编辑组合框

N = non-sorted drop list
N = 未排序下拉式列表

n = sorted drop list
n = 排序下拉式列表

1 = if the DDX insert should be added to head of list (default is add to tail)? This is generally used for DDX routines that

transfer the 'Control' property.

1 = 如果DDX插入应该在列表头(默认在列表尾)。这通常被DDX程序用于交换'Control'属性.

this field is used only in the 16-bit product for VBX controls (VBX controls are not supported in the 32-bit product)
这个域仅被用于16位VBX控件(VBX控件不被32位产品支持)

=

string to place in the Property combo box (no quotes)
在属性组合框中的名称字符串(不要包含引号)。
=

single identifier for type to emit in the header file. In our example above with DDX_Time, this would be set to CTime.
头文件中添加的类型的单一标识符。在我们的DDX_Time示例中应该被设置为CTime。

=

not used in this version and should always be empty
在此版本中没有使用,并且应该总是为空
=

initial value - 0 or blank. If it is blank, then no initialization line will be written in the //{{AFX_DATA_INIT section of

the implementation file. A blank entry should be used for C++ objects (such as CString, CTime, and so on) that have

constructors that guarantee correct initialization.

初始值- 0 或者空。如果为空,那么不会在实现文件中的//{{AFX_DATA_INIT节中写入初始化行。一个空条目应该用于像CString, CTime这样的构造函数正确的初始化的C++对象

=

single identifier for the DDX_ procedure. The C++ function name must start with “DDX_,” but don't include “DDX_” in the

identifier. In the example above, the identifier would be Time. When ClassWizard writes the function

call to the implementation file in the {{AFX_DATA_MAP section, it appends this name to DDX_, thus arriving at DDX_Time.
DDX_ 过程的单一标识符。C++ 函数名必须以DDX_开始,但是单一标识符中不包含“DDX_”。在上面的示例中, 标识符应该是Time。类向导在实现文件的{{AFX_DATA_MAP段中加入函数调用时在DDX_后面添加这个名字,所以达成DDX_Time。

=

comment to show in dialog for variable with this DDX. Place any text you would like here, usually provide something that

describes the operation performed by the DDX/DDV pair.
在对话框中显示的这个DDX的变量的注释。在这里放置任何需要的文字,通常提供一些描述DDX/DDV对完成的操作的描述。

The DDV portion of the entry is optional. Not all DDX routines have corresponding DDV routines. Often, it is more convenient

to include the validation phase as an integral part of the transfer. This is often the case when your DDV routine doesn't

require any parameters, since ClassWizard doesn't support DDV routines without any parameters.
条目的DDV部分是可选的。注意所有的DDX程序都有对应的DDV程序。很多时候,在数据交换中包含集成的验证部分更加方便,当你的DDV程序不需要任何参数时经常也是这样,因为类向导不支持没有参数的DDV过程。

= single identifier for the DDV_ procedure. The C++ function name must start with “DDV_” but don't include “DDX_” in the

identifier.
=DDX_ 过程的单一标识符。C++ 函数名必须以DDX_开始,但是单一标识符中不包含“DDX_”。

followed by 1 or 2 DDV args:
后接一到两个DDV参数
=

string to place above the edit item (with & for accelerator)
在编辑框上放置的字符串,其中的&用于加速键。
=

format character for the arg type, one of
参数类型的格式字符串。以下之一:
d = int

u = unsigned

D = long int (that is, long)

U = long unsigned (that is, DWORD)

f = float

F = double

s = string

An Example of Custom DDX
一个自定义DDX的样例
An example of custom DDX with validation can be found in the MFC Advanced Concepts sample CHKBOOK. See DDX_DollarsCents in

DOLLCENT.CPP for an sample implementation of a custom DDX routine and CHKBOOK.CLW for the corresponding example ExtraDDXCount

and ExtraDDX1 entries in the [General Info] section of CHKBOOK’s .CLW file.
一个包含验证的自定义DDX的样例可以在MFC高级概念示例CHKBOOK中找到。查看DOLLCENT.CPP中的DDX_DollarsCents,一个自定义DDX程序示例,以及CHKBOOK.CLW文件中的[General Info]节,对应的样例ExtraDDXCount和ExtraDDX1条目。

posted on 2004-05-14 11:16:00 by jiangsheng  评论(0) 阅读(5043)

Powered by: Joycode.MVC引擎 0.5.2.0