After the VC multi-document is converted to a single document, the "failed to create an empty document" dialog box is displayed. The reason and solution are as follows:

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.