My colleague converted a multi-document project developed by VC ++ 2003 into a single-document project and modified it according to the instructions on the Internet. However
Bool csditestapp: Statement in initinstance ()
If (! After processshellcommand (cmdinfo) is run, the "failed to create an empty document" dialog box is displayed. I have been bothering him for a while (two days). After I call it for a while, I only feel that it is caused by the failure of cmainframe creation, but I have not found the real cause. Later, he found the cause and modified it successfully. Cause: After the multi-document project is changed to a single document, the cmainframe object creation method has changed. Multiple documents are displayed and generated by the system.
The document is as follows:
Ccommandlineinfo cmdinfo; parsecommandline (cmdinfo); // schedule the command specified in the command line. If // starts the application with/regserver,/register,/unregserver, or/unregister, false is returned. If (! Processshellcommand (cmdinfo) return false; // a unique window is initialized, so it is displayed and updated m_pmainwnd-> showwindow (sw_show); m_pmainwnd-> updatewindow ();
Multiple documents are as follows:
Adddoctemplate (pdoctemplate); // create the main MDI frame window cmainframe * pmainframe = new cmainframe; If (! Pmainframe |! Pmainframe-> loadframe (idr_mainframe) return false; m_pmainwnd = pmainframe; // you can call dragacceptfiles only when a suffix exists. // in the MDI application, this should happen immediately after m_pmainwnd is set // analyze standard shell commands, DDE, and command line for opening file operations // ccommandlineinfo cmdinfo; parsecommandline (cmdinfo ); // schedule the command specified in the command line. If // starts the application with/regserver,/register,/unregserver, or/unregister, false is returned. // Raise info. m_nshellcommand = ccommandlineinfo: filenothing; If (! Processshellcommand (cmdinfo) return false; // The main window is initialized, so it is displayed and updated m_pmainwnd-> showwindow (m_ncmdshow); m_pmainwnd-> updatewindow ();
Solution:
Change implement_dynamic in the Multi-document cmainframe class to implement_dyncreate. The latter is generated dynamically and can be generated by the system.