CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Building Interactive UIs with ASP.NET Ajax: Rebinding Client-Side Events After a Partial Page Postback
  • Speed Up Repetitive Insert, Update, and Delete Query Statements
  • Binding Data to Silverlight 4.0 Controls Using ASP.NET MVC Framework 2.0
  • ADO.NET Data Services in the .NET Framework

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old January 5th, 2010, 03:41 PM
    davidpmp davidpmp is offline
    Member
     
    Join Date: Aug 2008
    Posts: 38
    davidpmp is on a distinguished road (10+)
    Create hidden SDI application

    Hi,

    I need to create a single document instance(SDI) application to initialize hidden. but when I remove show window and update window lines, the application initialize main window visible. How can I do it ?!?

    CSingleDocTemplate* pDocument = new CSingleDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(MyDocument), RUNTIME_CLASS(MyMainFrame), RUNTIME_CLASS(MyView));

    MyView = CFormView
    MyMainFrame = CMainFrame
    MyDocument = CDocument


    Thanks in advance,
    Reply With Quote
      #2    
    Old January 5th, 2010, 04:21 PM
    hoxsiew hoxsiew is offline
    Elite Member
     
    Join Date: Feb 2005
    Posts: 2,112
    hoxsiew is a glorious beacon of light (400+)hoxsiew is a glorious beacon of light (400+)hoxsiew is a glorious beacon of light (400+)hoxsiew is a glorious beacon of light (400+)hoxsiew is a glorious beacon of light (400+)hoxsiew is a glorious beacon of light (400+)
    Re: Create hidden SDI application

    Note: this is with VS2005 and MFC9; YMMV.

    In your main app class, in InitInstance() modify as so:

    Near the beginning (you really only need to do this once as it will remain in the registry thereafter):
    Code:
      SetRegistryKey(_T("Local AppWizard-Generated Applications"));
      LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
    
    
      CRect r;
      int flg,shc;
      LoadWindowPlacement(r,flg,shc);
      StoreWindowPlacement(r,flg,SW_HIDE);
    
    
      InitContextMenuManager();
    And near the end of InitInstance:

    Code:
    	if (!ProcessShellCommand(cmdInfo))
    		return FALSE;
    
    	// The one and only window has been initialized, so show and update it
    	m_pMainWnd->ShowWindow(SW_HIDE);
    	m_pMainWnd->UpdateWindow();
    	// call DragAcceptFiles only if there's a suffix
    	//  In an SDI app, this should occur after ProcessShellCommand
    The in your frame class, use the class wizard or properties tab to override ActivateFrame() and change as so:

    Code:
    
    void CMainFrame::ActivateFrame(int nCmdShow)
    {
      // TODO: Add your specialized code here and/or call the base class
    
      CFrameWndEx::ActivateFrame(SW_HIDE);
    }
    Reply With Quote
      #3    
    Old January 5th, 2010, 04:27 PM
    davidpmp davidpmp is offline
    Member
     
    Join Date: Aug 2008
    Posts: 38
    davidpmp is on a distinguished road (10+)
    Re: Create hidden SDI application

    thanks,
    work perfectly
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 02:17 AM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.