• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

remove Document from MDI.

hi,

i want to remove doc from MDI application.
After create new document , i have to get the handle and close the document.

1. I cannot call the OnCloseDocument() within OnInitialUpdate ( CView ).

2. If I call OnCloseDocument within OnShowWindow ( CView ), document is closing but "Failed to create empty document" error is comming.
 
regards,
raj
0
raj_selvam
Asked:
raj_selvam
  • 2
1 Solution
 
Roshan DavisCommented:
If u don't want to open any document at starting, In YourApp::InitInstance() use the code as below

     CCommandLineInfo cmdInfo;
     ParseCommandLine(cmdInfo);

     //****** NEW LINE ADDED HERE *******
     cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
     //**********************************

     // Dispatch commands specified on the command line
     if (!ProcessShellCommand(cmdInfo))
          return FALSE;


GOOD LUCK
0
 
Roshan DavisCommented:
Or You can call

GetParent()->PostMessage(WM_CLOSE);

in InitialUpdate of CView

GOOD LUCK
0
 
raj_selvamAuthor Commented:
Thanx roshmon,
this is exactly, what i want!!!

regards,
selvam
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now