1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| void CMfcAutoDlg::OnRun()
{
Application Grapher;
Documents docs;
Document doc1;
//get its dispatch interface. This will start Grapher
if(!Grapher.CreateDispatch(_T("Grapher.Application")))
{
AfxMessageBox(_T("Call to CreateDispatch on server failed"));
return;
}
//make the program visible
Grapher.SetVisible(TRUE);
//get a pointer to the Documents object
docs = Grapher.GetDocuments();
//add a new plot window
doc1 = docs.Add(COleVariant(),COleVariant(),COleVariant());
// LPDISPATCH Add(const VARIANT & type, const VARIANT &templateFile, const VARIANT &wksFile)
} |
Partager