Пример #1
0
void CLuaIDEInterfaceImpl::addFile(const char *filename)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    CProject *proj = theApp.GetMainFrame()->GetProject();
    if (proj->GetProjectFile(filename))
        return;

    theApp.GetMainFrame()->GetProject()->AddFile(filename);
    CDocument *doc = theApp.OpenDocumentFile(filename);
    if (doc)
    {
        POSITION p = doc->GetFirstViewPosition();
        for (;;)
        {
            CView *v = doc->GetNextView(p);
            if (!v) break;
            theApp.GetMainFrame()->MDIActivate(v);
            BOOL maximized;
            CMDIChildWnd* child = theApp.GetMainFrame()->MDIGetActive(&maximized);
            if (child && (!maximized))
            {
                child->MDIMaximize();
            }
        }
    }
}
Пример #2
0
BOOL CRC5TestApp::InitInstance()
{
	BOOL bMax;
	CMDIChildWnd *pChildWnd;

	// InitCommonControls() is required on Windows XP if an application
	// manifest specifies use of ComCtl32.dll version 6 or later to enable
	// visual styles.  Otherwise, any window creation will fail.
	InitCommonControls();

	CWinApp::InitInstance();

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	AfxEnableControlContainer();
	// Standard initialization
	// If you are not using these features and wish to reduce the size
	// of your final executable, you should remove from the following
	// the specific initialization routines you do not need
	// Change the registry key under which our settings are stored
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));
	LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)
	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views
	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(IDR_RC5TestTYPE,
		RUNTIME_CLASS(CRC5TestDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CRC5TestView));
	if (!pDocTemplate)
		return FALSE;
	AddDocTemplate(pDocTemplate);
	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;
	// call DragAcceptFiles only if there's a suffix
	//  In an MDI app, this should occur immediately after setting m_pMainWnd
	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);
	// Dispatch commands specified on the command line.  Will return FALSE if
	// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;
	// The main window has been initialized, so show and update it
	pMainFrame->ShowWindow(SW_MAXIMIZE);
	pChildWnd = pMainFrame->MDIGetActive(&bMax);
	if (pChildWnd && (!bMax))
	{
		pChildWnd->MDIMaximize();
	}
	pMainFrame->UpdateWindow();

	return TRUE;
}