Microsoft Office OneNote C++ APIs?

房东的猫 提交于 2019-12-11 02:39:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!