Today, we have finally finished the interface that we have always wanted to do like MMC in windows.
Now I have a little fun, and I will summarize my experiences as follows:
1. Create an SDI project named dbvview in vc6.0, and select "application split form" in the Windows style in Step 6 of the wizard ". After the project is created, we can see that the project created by the "Application split form" option is selected is different from the general project: A csplitterwnd variable m_wndsplitter is added to the cmainframe class, this variable is used to split the form.
2. Create a new class cnewview, which is derived from the cview class.
3. Reload the cmainframe: oncreateclient () function.
Bool cmainframe: oncreateclient (lpcreatestruct lpcs, ccreatecontext * pcontext)
{
M_wndsplitter.createstatic (this, 1, 2 );
M_wndsplitter.createview (100,100, runtime_class (cnewview), csize (), pcontext );
M_wndsplitter.createview (100,100, runtime_class (cdbvview), csize (), pcontext );
Return true;
}
The createstatic (this,) function splits the current main frame into one row and two columns. After the framework is split, the number starts from 0 rows and 0 columns.
The createview (100,100, runtime_class (cnewview), csize (), pcontext) function enables the View class cnewview to be displayed in
The Framework has 0th rows and 0th columns.
This completes the split form and binds the custom View to the split form.
However, when I runProgramWhen a problem occurs, the program reports an error: cdbvview is not a class name or namespace.
So I added a header file # include "dbvview. H" to mainframe. cpp"
This error is missing. However, a new error occurs again.
Error c2143: syntax error: ";" missing (before)
Error c2501: "cdbvview: cdbvdoc": the storage class or type specifier is missing.
Error c2501: "cdbvview: getdocument": the storage class or type specifier is missing.
Warning c4183: "getdocument": The return type is missing. It is assumed that it is a member function that returns "int ".
After checking on the Internet for a long time, I finally learned the cause. There is a cdbvdoc * getdocument () const in cdbvview. h;
Cdbvview. h does not contain cdbvdoc. Therefore, you only need to include cdbvdoc. h In cdbvview. h.