Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1997-07-23
9
Medium Priority
?
327 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 200 total points
ID: 1165746
Nice ! Accept this , pls
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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

963 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