问题
I was looking into modifying Microsoft Office OneNote contents via c++ programming. Specifically at using Quick Filing Dialog Box Interfaces. But all the examples available in there are for C#, I want to know whether API for C++ is available, if so where can I start to learn them. I just wanted to use that dialog box get the OneNote section and insert my content as a page in that section.
回答1:
As Daniel Escapa writes:
Open Visual Studio and create a new C++ project. For my example I am creating a Win32 Console App:
Now I want to add the OneNote2007 header file, OneNote12.h. You can find that attached with this document. Make sure to copy it to the folder with your C++ source files as well as add it to your header files like this:
Add a new #include for OneNote:
#include "OneNote12.h"
Now just connect to OneNote like you would any other COM API. Please see here for an example:
CoInitialize(NULL);
IApplication* piOneNote;
CoCreateInstance(__uuidof(Application), NULL,
CLSCTX_LOCAL_SERVER, __uuidof(IApplication), (void**)&piOneNote);
if(piOneNote)
{
BSTR temp;
HRESULT hr = piOneNote->GetHierarchy(NULL, hsNotebooks, &temp);
wprintf(L"%s", temp);
}
来源:https://stackoverflow.com/questions/16913579/microsoft-office-onenote-c-apis