LRESULT CPageDesignerApp::OnFileNew(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { CNewDocumentDlg dlg; dlg.m_numPages = 1; dlg.m_pageWidth = ConvertSpecifiedValueToUserUnit(UNIT_PT, 612); dlg.m_pageHeight = ConvertSpecifiedValueToUserUnit(UNIT_PT, 792); dlg.m_marginLeft = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36); dlg.m_marginRight = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36); dlg.m_marginTop = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36); dlg.m_marginBottom = ConvertSpecifiedValueToUserUnit(UNIT_PT, 36); dlg.m_columnNumber = 1; dlg.m_columnGutter = ConvertSpecifiedValueToUserUnit(UNIT_PT, 12); dlg.m_facingPages = TRUE; if (dlg.DoModal(GetMainHwnd(), NULL) == IDOK) { CComObject<CPDDocument>* pDocument; CComObject<CPDDocument>::CreateInstance(&pDocument); if (pDocument) { pDocument->AddRef(); pDocument->m_pageWidth = dlg.m_pageWidth; pDocument->m_pageHeight = dlg.m_pageHeight; pDocument->m_marginTop = dlg.m_marginTop; pDocument->m_marginBottom = dlg.m_marginBottom; pDocument->m_marginInside = dlg.m_marginLeft; pDocument->m_marginOutside = dlg.m_marginRight; pDocument->m_columnNumber = dlg.m_columnNumber; pDocument->m_columnGutter = dlg.m_columnGutter; pDocument->m_facingPages = dlg.m_facingPages? VARIANT_TRUE: VARIANT_FALSE; WCHAR str[256]; swprintf(str, L"Untitled%d.pddoc", ++m_nextDocumentIndex); pDocument->m_fileTitle = str; pDocument->NewDocument(); // Init (?) pDocument->CreatePages(dlg.m_numPages); pDocument->ShowViews(); // CComQIPtr<IUIManager> uiManager = m_frame; // CComQIPtr<IPDDocument> document = pDocument; // CComPtr<IUnknown> _this; // QueryInterface(IID_IUnknown, (void**)&_this); //uiManager->ActivateObject(GetUnknown(), document); } } #if 0 HINSTANCE hLib = LoadLibrary("C:\\mmsx\\mmstudioplugins\\DOMCOREMOD.dll"); if (hLib) { HTMLModalDialogProc HTMLModalDialog = (HTMLModalDialogProc)GetProcAddress(hLib, "HTMLModalDialog"); if (HTMLModalDialog) { CComQIPtr<IDOMDocument> xmldoc; xmldoc.CoCreateInstance(CLSID_LDocument); xmldoc->put_async(VARIANT_FALSE); VARIANT_BOOL success; xmldoc->loadXML(L"<newdocument/>", &success); CComQIPtr<IDOMElement> element; xmldoc->get_documentElement(&element); WCHAR buf[64]; swprintf(buf, L"%d", 1); element->setAttribute(L"pagesnum", buf); swprintf(buf, L"%d", 1); element->setAttribute(L"columnsnum", buf); swprintf(buf, L"%dpt", 1); element->setAttribute(L"columnsgutter", buf); _variant_t arg = (IDispatch*)element.p; _variant_t result; HTMLModalDialog(GetMainHwnd(), L"C:\\MMStudio\\pd_newdocument.html", &arg, L"", &result); CComObject<CPDDocument>* pDocument; CComObject<CPDDocument>::CreateInstance(&pDocument); if (pDocument) { pDocument->AddRef(); pDocument->NewDocument(); // Init (?) pDocument->m_pageWidth = 200; pDocument->m_pageHeight = 400; pDocument->CreatePages(4); pDocument->ShowViews(); CComQIPtr<IUIManager> uiManager = m_frame; CComQIPtr<IPDDocument> document = pDocument; CComPtr<IUnknown> _this; QueryInterface(IID_IUnknown, (void**)&_this); uiManager->ActivateObject(_this, document); } } else { MessageBox(GetMainHwnd(), "Couldn't find proc", "PageDesigner", MB_OK); } FreeLibrary(hLib); } else { MessageBox(GetMainHwnd(), "Couldn't load library", "PageDesigner", MB_OK); } #endif #if 0 CComObject<CESvgDocument>* pDocument; CComObject<CESvgDocument>::CreateInstance(&pDocument); pDocument->AddRef(); if (pDocument != NULL) { pDocument->NewDocument(); pDocument->ShowViews(); CComPtr<IUnknown> unk; pDocument->QueryInterface(IID_IUnknown, (void**)&unk); m_frame->ActivateObject(unk); } #endif return 0; }