Click to See Complete Forum and Search --> : Docs and Threads


Mario Pereira
September 14th, 1999, 12:33 PM
I have an MDI app and need to use one of its docs in another thread for background printing. I only need the doc, not the view as the printing should be invisible for the user.
Is there a way to create the doc inside the thread (a worker thread)?

Oleg Lobach
September 15th, 1999, 03:20 AM
Try this:
1. To open existing document:

CRuntimeClass * pClass=RUNTIME_CLASS(CYourDoc);
CYourDoc* pDoc= (CYourDoc*)pClass->CreateObject();
pDocument->m_bEmbedded = TRUE; // avoid creating temporary compound file
pDoc->OnOpenDocument("FileName.foo");



2. To create new empty document:

CRuntimeClass * pClass=RUNTIME_CLASS(CYourDoc);
CYourDoc* pDoc= (CYourDoc*)pClass->CreateObject();
pDocument->m_bEmbedded = TRUE; // avoid creating temporary compound file
pDoc->OnNewDocument();




Let me know if it helps.
Good luck,
Oleg.