Solved

How to get My CFormview title added to the list of the Windows opened files

Posted on 1997-07-23
9
313 Views
Last Modified: 2012-05-07
I am using VC++ (1.5) and I am creating 4 CFormview windows which contains list boxes, each form view got a special title and ID resouce. Basically I am using OpenDocumentFile(NULL) to trigger the whole process for each form view, and because I've have no ducument to open (my form view build their content from a database) I couldnt get the form view title to show under Windows Menu as opened document so the user can user the keyboard to get their and select them.

how the MFC is doing when you call OpenDocumentFile(filename); I've looked at the code and I couldnt see anything that update the menu or popup menu???

Any Help will be appreciated
 
0
Comment
Question by:youcef
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 3

Expert Comment

by:jaba
ID: 1165738
MFC nt doing  anything to add you view title into Windows menu . If you using MDI application, MDI Frame and MDI client doing it. I think, you doing somthing wrong while initialisation of you views. How you setting title to view ? Do you using different teplates to create views ? Do you caling OpenDocumentFile member of CWinApp or CDocumentTemplate class ?

0
 

Author Comment

by:youcef
ID: 1165739
Thanks for your valuable comment, here are more details:
My Application is an MDI one, and I am creating different template for each Form view window (basically they are using the same MDI frame, Document, and view the only difference is the ID resource which point to different Icon and title).

And I am using the CDocumentTemplate OpenDocumentFile, here is an extract of the code that trigger the process:

void MyCwinApp::NewWindow(){

CMultiDocTemplate* pDocTemplate;

      pDocTemplate = new CMultiDocTemplate(
            IDR_WAITING+iBinId,
            RUNTIME_CLASS(CFaxLinkDoc),
            RUNTIME_CLASS(CAELMDI),
            RUNTIME_CLASS(CListBoxForm));
      AddDocTemplate(pDocTemplate);        

      pDocTemplate->OpenDocumentFile(NULL);

0
 

Author Comment

by:youcef
ID: 1165740
Thanks for your valuable comment, here are more details:
My Application is an MDI one, and I am creating different template for each Form view window (basically they are using the same MDI frame, Document, and view the only difference is the ID resource which point to different Icon and title).

And I am using the CDocumentTemplate OpenDocumentFile, here is an extract of the code that trigger the process:

void MyCwinApp::NewWindow(int iBinId){

CMultiDocTemplate* pDocTemplate;

      pDocTemplate = new CMultiDocTemplate(
            IDR_WAITING+iBinId,
            RUNTIME_CLASS(CFaxLinkDoc),
            RUNTIME_CLASS(CAELMDI),
            RUNTIME_CLASS(CListBoxForm));
      AddDocTemplate(pDocTemplate);        

      pDocTemplate->OpenDocumentFile(NULL);
}

Hope this will help.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:jaba
ID: 1165741
Hmm , do you keep pDocTemplate pointer or creating new instance every time when you want to open window of this class ?
And , what kind of messages /virtual function you override in CAELMDI ?
0
 

Author Comment

by:youcef
ID: 1165742
I create a new instance every time I want to create a window of that class (basically I do it only once for every form view) i.e. at the end I end up with 1 instance window for each class that last till the application close.

As for CAEMDI I am using/overriding the following Messages:

      afx_msg void OnClose();
      afx_msg void OnDestroy();
      afx_msg void OnMDIActivate(BOOL,CWnd*,CWnd*);
      afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

Note: I've just created another Form,View,Document template That I am using for the purpose to show the summary report/content of each window it's an rpt (Crystal Report) file that I am opening using openDocumentFile(rtp file name) of the CWinApp and suddenly all the windows title appears under the Windows Menu?????
Still dont understand Why not before the rpt file is opened the system doesnt seems to work.
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1165743
You can use CWnd::GetMenu() to retrive pointer to CMenu object of MainFrame and then call CMenu::GetSubMenu() to get pointer to "Windows" popup menu. Then you can call CMenu::AppendMenu() to add whatever you want ( title and ID of your form view )
0
 
LVL 3

Expert Comment

by:jaba
ID: 1165744
Check you OnMDIActivate function. Do you calling base class member ?
OnMDIActivate(BOOL flag,CWnd* pWndL,CWnd* pWndN)
{
CMDIChildWnd::OnMDIActivate(flag,pWndL, pWndN);
// you code here
}
0
 

Author Comment

by:youcef
ID: 1165745
Hi Jaba,
You got it right men, I've just put the base class CMDIChildWnd::OnMDIActivate(flag,pWndL, pWndN); and the magic happened, Thank you very much, you are a saver.
0
 
LVL 3

Accepted Solution

by:
jaba earned 50 total points
ID: 1165746
Nice ! Accept this , pls
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

622 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