Welcome to MSDN Blogs Sign in | Join | Help

Creating a C/C++ Add-In which works with OneNote!

I thought I would take some time today and write up how to program a C/C++ add-in that works with OneNote 2007. Here are the directions I had and downloads below.

  1. Open Visual Studio and create a new C++ project.
  2. For my example I am creating a Win32 Console App:

  3. 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:

  4. Add a new #include for OneNote:

    #include "OneNote12.h"

  5. 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);

        }

A huge thanks to Ilya Koulchin for his help with this, I couldn't have done this without you!

Downloads:

This should be all that you need to get this working, but if you need anything please let us know!

Published Tuesday, February 06, 2007 10:23 PM by descapa

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Developers: Links to Dan Escapa’s Posts at OneNote PowerToys

# re: Creating a C/C++ Add-In which works with OneNote!

Do you know if something similar can be done with a program written in VB.NET?  I imagine it would work the same way.  I have a VB.NET program that I would like to do this with in addition to C++ addins.

Thursday, March 15, 2007 3:22 PM by basketcase39

# re: Creating a C/C++ Add-In which works with OneNote!

basketcase39  - You can do the same with VB.Net, you would just need to create a COM addin with VB.Net and then register that with OneNote.  Most of it will be the same directions, I just don't know how to program in VB.Net.  If you take my directions found here:

http://blogs.msdn.com/descapa/archive/2006/08/31/734298.aspx

You can see how to do it in C#, it should be fairly easy from that.

If you get it working please shoot me a line so I can post it on my blog!

Friday, March 16, 2007 9:41 PM by descapa

# re: Creating a C/C++ Add-In which works with OneNote!

After some lengthy discussions with the seller and his broker, I discovered that the seller had a first mortgage with a balance of about $125,000

Saturday, March 24, 2007 9:41 AM by HOMEADVANCEGUIDE

# re: Creating a C/C++ Add-In which works with OneNote!

The term of 'Add in' doesn't define a 'plug in',isn't it?

Friday, April 20, 2007 8:03 AM by alexandre7g

# re: Creating a C/C++ Add-In which works with OneNote!

Hi Daniel, I'm wondering if the C++ approach to add-ins would make sense for this: I want/need to add a function for napkin math.  It has a nice set of functions already, but I want to be able to type in quad(1,-1,-1) and have it return the quadratic roots of the function x^2-x-1.  What do you think?  Could you point me in the right direction to getting this question answered?

Thanks!

Sunday, May 17, 2009 8:16 PM by Drew Kesler (Groton School)

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker