Solved

remove Document from MDI.

Posted on 2002-05-29
3
280 Views
Last Modified: 2013-11-20
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
Comment
Question by:raj_selvam
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7041517
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
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 100 total points
ID: 7041528
Or You can call

GetParent()->PostMessage(WM_CLOSE);

in InitialUpdate of CView

GOOD LUCK
0
 
LVL 1

Author Comment

by:raj_selvam
ID: 7043405
Thanx roshmon,
this is exactly, what i want!!!

regards,
selvam
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now