CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    Lincoln NE
    Posts
    113

    How to open different document templates using button messages?

    Hello all,

    Perhaps the answer to this question may be found in some FAQ somewhere,
    but I could not locate a simple answer yet.

    I want to create more than one document template and open a specific one if the user selects a toolbar button; I don't want the program to display the File type dialog box. I had once learned how to bypass the dialog, but never found out how to start up a certain doc type depending on a button message.

    Does anyone know where I should answer the toolbar message and what steps I should take to create/open a certain doc type?

    Sincerely,

    Hurol Aslan


  2. #2
    Join Date
    Jul 1999
    Location
    Moscow, Russia
    Posts
    667

    Re: How to open different document templates using button messages?

    Hi,
    Try this:

    1.Add these lines to your CWinApp derived:

    CMultiDocTemplate *pTemplate1;
    CMultiDocTemplate *pTemplate2;
    ..
    CMultiDocTemplate *pTemplateN;


    ;
    2.In your InitInstance "init" these pointers:

    pTemplate1=new CMultiDocTemplate(..);
    pTemplate2=new CMultiDocTemplate(..);
    ...
    pTemplateN=new CMultiDocTemplate(..);



    and delete the line wit ProcessShellCommand call.
    3.Create handlers for your toolbar buttons in which create empty documents:

    pTemplate1->OpenDocumentFile(NULL);
    ...




    Good luck,Oleg.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured