A Problem I Solved Last Night

来源:互联网 发布:淘宝返现怎么领取 编辑:程序博客网 时间:2024/04/26 11:47

As we know,the frame of MFC use the patten of observe.When we create a single document application,it create an application class,a frame window class a view window class and a document class.The view window is a child of the frame.

  As I know little about the observer patten,and Many detail of it are strange to me,a problem occure last night,and cost me hours to solve it.I try to add a view window to the frame,so I create a class who derive from CFormView.The class of CFormView is require a dialog to associate with it.The dialog who associate with CFormView class must have the style of CHILD.But I don't know of this.A error dialog was show when I run my program,and it was terminated when I clicked the ignore button.I didn't know what had happen.The debug programe show the line where the error occured,this line was just a function-call code,and I didn't clear about the function.

  I went into the code of this function and traced the path the programe go with.Many time I try,and no result come out.Painful I was.In the processe of the trace,I learn useful things, such as MAKEINTERSOURCE. MAKEINTERSOURCE is macro which change an integer Id which identify a source into a string which also identity a source. Finaly I found in a funtion that the resource of the dialog which accociate with the CFormView lack the sytle of CHILD.

原创粉丝点击