Click to open or copy the BookNote project files.
BookNote lets you record notes (like permanent bookmarks), associating them with code. The sample also shows using the registry to persist a number of items in an MRU list. BookNote was created with the ATL COM AppWizard. Support MFC was checked in the wizard, and then an Add-in object was added to the project with the ATL Object Wizard. Most of the code added is in MarkIt.cpp.
If you modify the sample, precede each function that could be called from an external interface with the following code:
AFX_MANAGE_STATE(AfxGetStaticModuleState());
This allows you to access your resources and is necessary because of the MFC support.
The CMRUStrings
class is used to do the persistence for a drop-down combo box. You can use this class and other classes from the add-ins in other projects. See Reusing Code Topics and Adding Classes to the Gallery for information on how to reuse code.
To build the sample
To run the add-in
There is a check box for indenting notes that is on by default. If you copy text out of the output window and want to navigate to it, turn indenting off.
There is a button that dumps the file to the output window. The button does not close the dialog box. This is useful for putting any file into the output window; clicking Cancel stops recording a note.
Sample output
C:\VC98\VC98\CRT\SRC\DBGHEAP.C(328) : (09:16:04 PM 02/09/1998)
328: set _crtDbgFlag and _crtBreakAlloc to find memory leaks
Before dumping files into the output window, you may want to clear the output window first. Use the context menu (right-click and choose Clear).
This sample demonstrates the following keywords:
CTimeSpan; CTime::GetCurrentTime; CTime::Format; CRegKey::QueryValue; CRegKey::Create; CRegKey::SetValue, ITextSelection, IApplication, CRegKey; ITextSelection::get_TopLine; CComPtr, CComQIPtr, ITextDocument::get_FullName; CComBSTR, IApplication::PrintToOutputWindow; addin; customize.