Javascript写的星际?
http://www.openlab.com.cn/~comy/jsscV1.0/sc.htm
?
posted on 2004-05-27 05:37:00 by jiangsheng 评论(26) 阅读(5175)
随笔 - 142, 评论 - 629, 引用 - 27 |
||
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就可以复制到剪贴板了。这估计会很大程度上减少技术支持人员的电话费用。 --------------------------- 在自己写的程序里面写这样的代码似乎也不困难。
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 没有合乎您要求的网页。 您输入的地址可能不正确,或者该网页并不存在. 这不是问题,问题是在站里面找不到文章的新位置了,没有办法更新书签。 好在百度还有快照 posted on 2004-05-14 14:09:00 by jiangsheng 评论(8) 阅读(2547) 对话框数据交换(MFC) //{{Jiangsheng的牢骚(对话框数据交换) 本文的内容以现状提供并且不提供任何担保,Jiangsheng不对使用本文造成的可能的损失负责 通常,简单的对话框不使用结构来存储成员数据。但是大量的简单类型的成员交换会使得代码繁琐。这时候可以使用结构来封装简单类型的数据,声明一个赋值操作符和修改DDX调用来简化数据交换代码。 例如在文档或者视图的命令处理函数中 void CMyDialog::DoDataExchange(CDataExchange* pDX) 这里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, http://www.microsoft.com/china/community/content/news/mstranslate.aspx里面的链接似乎都是死链接? 这里是我以前写的一个自定义的DDX的代码。 posted on 2004-05-14 11:33:00 by jiangsheng 评论(4) 阅读(4418) 对话框数据交换??? //{{Jiangsheng的垃圾代码(对话框数据交换) 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_InfoField(CDataTypeFieldExChange* pDX, int nIDC, CTextFieldEdit& rControl) >m_strInfoField)); ??} void DDX_TextField(CDataTypeFieldExChange* pDX ?CString strVal; ??} ?if(pDX->m_pDX->m_bSaveAndValidate){ } 附我的翻译 http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfcnotes_tn026.asp TN026: DDX and DDV Routines 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. 的程序。 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: 换和验证。它总是由这种形式组成 void CMyDialog: ??? //{{AFX_DATA_MAP(CMyDialog) 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. In the above example, ??? DDX_Custom(pDX, nIDC, field); and More than one DDX_/DDV_ pair may be included in each DoDataExchange function. See 'afxdd_.h' for a list of all the dialog data exchange routines and dialog data validation routines provided with MFC. Dialog data is just that - member data in the CMyDialog class. It is not stored in a struct or anything special like that. Notes Although we call this “dialog data,” all features are available in any class derived from CWnd and are not limited to just dialogs. Initial values of data are set in the standard C++ constructor, usually in a block with //{{AFX_DATA_INIT and //}} AFX_DATA_INIT comments. CWnd::UpdateData is the operation that does the initialization and error handling around the call to 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. The DDV_ routine should immediately follow the DDX_ routine for that field. 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: object) has a direction flag much like CArchive has a direction flag: PDX参数是数据交换的上下文,而且类似CObject: ??? if !m_bSaveAndValidate, then load the data state into the controls ??? if m_bSaveAndValidate, then set the data state from the controls Validation only occurs when m_bSaveAndValidate is set. The value of m_bSaveAndValidate is determined by the BOOL parameter to CWnd::UpdateData. There are three other interesting CDataExchange members: 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. 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. 件,而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. Fail:在显示一个消息框提示用户输入错入之后调用。这个程序将恢复焦点到最后的控件(最后一个调用PrepareCtrl/PrepareEditCtrl的)并且 抛出一个异常。这个成员在DDX_和DDV_程序中都可以调用。 There are several ways to extend the default DDX/DDV mechanism. You can: Add new data types. CTime Add new exchange procedures (DDX_???). void PASCAL DDX_Time(CDataExchange* pDX, int nIDC, CTime& tm); Add new validation procedures (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)). Have the DoDialogExchange member function include conditionals or any other valid C++ statements with intermixed exchange and validation function calls. //{{AFX_DATA_MAP(CMyClass) 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_程序的时候有好处。 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 ; Where ? is a number 1-n indicating which DDX type in the list that is being defined. Each field is delimited by a ';' character. The fields and their purpose are described below. =指名此变体类型允许何种对话框控件的单字符列表 C = two-state check box c = tri-state check box R = first radio button in a group L = non-sorted list box l = sorted list box M = combo box (with edit item) N = non-sorted drop list n = sorted drop list 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) 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. 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 call to the implementation file in the {{AFX_DATA_MAP section, it appends this name to DDX_, thus arriving at 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. 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. = single identifier for the DDV_ procedure. The C++ function name must start with “DDV_” but don't include “DDX_” in the
followed by 1 or 2 DDV args: string to place above the edit item (with & for accelerator) format character for the arg type, one of 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 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. posted on 2004-05-14 11:16:00 by jiangsheng 评论(0) 阅读(5043) |
||
|
Powered by: Joycode.MVC引擎 0.5.2.0 Copyright © jiangsheng |
||