Print Page | Close Window

Multiple-Top Level Documents Issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9198
Printed Date: 14 November 2025 at 8:04am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple-Top Level Documents Issue
Posted By: mgoldshteyn
Subject: Multiple-Top Level Documents Issue
Date Posted: 30 December 2007 at 10:28am
1. Create a new Tookit Pro project using App Wizard ((VS2005 or VS2008) and XTP 11.2.2)
2. Under Application Type, select Multiple top-level documents
3. Deselect Use Unicode libraries on that same page
4. Leave all other settings as is
5. Click Finish
6. Build and run the resultant application in Debug mode
7. When the app is running, select New Frame from the File menu
8. *KABOOM* to an assertion, since the new Frame has no menu, even though one was assigned at the time of window creation.
 
Mike
 



Replies:
Posted By: mgoldshteyn
Date Posted: 30 December 2007 at 3:19pm
Here is the fix! Modify the following code in the AppWizard generated CMainFrame::LoadFrame()
 
// replace Exit option on File menu with Close for secondary windows
if (AfxGetApp()->m_pMainWnd != this)
{
  CMenu *pMenu = GetMenu();
  ASSERT(pMenu);
  pMenu->ModifyMenu(ID_APP_EXIT, MF_BYCOMMAND | MF_STRING, ID_FILE_CLOSE, _T("&Close"));
}
 
with:
 
// replace Exit option on File menu with Close for secondary windows
if (AfxGetApp()->m_pMainWnd != this)
{
  // Find the File/Exit control nested deep in the command bar hierarchy
  CXTPControl *pAppExitControl=GetCommandBars()->FindControl(xtpControlButton, ID_APP_EXIT, TRUE /*Visible*/, TRUE /*Recursive*/);
  // If File/Exit was found, change its name/behavior to File/Close
  if (pAppExitControl)
  {
    // Change its ID and caption to that of File/Close
    pAppExitControl->SetID(ID_FILE_CLOSE);
    pAppExitControl->SetCaption(_T("&Close"));
  }
}

Oleg or another admin, please comment on this solution. Also, for everyone's sake, fix the AppWizard generated code in the next release to use the code above or something similar.
 
 


Posted By: Oleg
Date Posted: 02 January 2008 at 2:07am

Hi,

Thanks, we changed appwizard with this code. Thanks for help.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net