Click here to Skip to main content
15,866,422 members
Articles / Desktop Programming / MFC
Article

Visual Studio Bookmark Saver Add-In

Rate me:
Please Sign up or sign in to vote.
4.69/5 (8 votes)
6 Feb 2000 91.1K   1.5K   36   14
Visual Studio add-in which saves and restores bookmarks after closing and re-opening a file.
  • Download source files - 49 Kb
  • Download binary files - 33 Kb
  • Sample Image - bookmark.gif

    Overview of the Add-In:

    The feature to set bookmarks (using Ctrl-F2) in a text file available in the Dev Studio editor is very useful when going through a HUGE source file. The drawback is that, once the text file is closed you lose all the bookmarks set in that particular file and it's a pain to set them all again.

    So, anyway I guess you know what this add-in does by now. It, remembers the bookmarks set in a file (as shown above) and re-sets them back if the file is opened later in Dev Studio.

    Installation:

    • Copy the bookmark.dll file (after downloading it of course) where-ever you want (I put them in Devstudio\sharedide\AddIns).
    • In, DevStudio, go to the Tools menu and select Customize...
    • Go to the last tab (Add-Ins and macro Files). You should be able to see the Book Mark add-in in the list box (if you saved it in the path above. If you've saved it in a different path, you'll have to browse for it yourself). Once, you checked the bookmark add-in, click close.
    • You will now be presented with a dialog box asking you to choose a folder to store the bookmarks. Choosing any directory will work fine. Clicking cancel will however unload the bookmark add-in. You will only be asked to specify this folder once.

    Usage:

    The add-in runs without user interaction.

    You do have a choice to set the options. You can enable or disable the bookmark add-in on the fly (by choosing the Bookmark command which brings up the dialog box as shown below).

    Image 2

    Options Page:

    Disabling the bookmark add-in will not restore your bookmarks the next time you open the file.

    The user also has the option of saving the bookmark locations

    1. When user closes a document OR
    2. When user saves a document (for the paranoid, like myself who thinks that DevStudio will crash anytime for any reason)

    The delete file button simply purges any bookmark locations that you might have accumulated during your long hours of coding

    Advanced Page:

    Image 3

    The first version of the add-in was quite inflexible in the manner that the user couldn't selectively remove bookmark locations stored in the file. Well, now the user can selectively remove a line or the whole file. I'll let you play around with the add-in.

    Un-Installing:

    Un-check the bookmark add in (in the tools customize page). Delete the bookmark.dll and also, a file called bookmark.dat (which is automatically created by the add-in) which is stored where the user specifies.

    History

    Update: (4th September 1998)

    Now the users can remove files or lines in the advanced page with the use of the keyboard. Just press the delete key. The user can also open any file by using the F3 key. Double clicking on the line number will open the file and scroll to the line number and highlight the line to give you an indication as to where the bookmark is set. F3 works with both Files and Line numbers.

    Update: (2nd December 1998)

    DevStudio process did not seem to terminate itself properly when users would open a file from the dialog box (using the F3 key or choosing the menu option available). I don't know why this seems to happen, so to prevent from DevStudio's process not terminating properly, I have removed the functionality whereby the user can open a file until I find out exactly why this happens. - Bug found (it's the nasty one described below) and fixed, functionality is back in! :)

    Update: (26th January 1999)

    Bug fixes:

    Could not delete files from the list (in the advanced page) which did not exist on the drive. (Thanks to Matthew Ellis for finding the bug) This is now fixed.

    Additions:

    When navigating code using the browse facility, the add-in would remove the highlighted piece of code, regardless of whether there was a bookmark set for that file or not. (Thanks to Matthew Ellis for the suggestion)

    Update: (14th June 1999)

    Bug fixes:

    Fixed a real nasty bug, that had been around from day 1 (sorry people). A lot of people experienced this bug and now it's finally fixed. The bug was that, after opening a file from the advanced tab and then trying to shut down DevStudio (V5 or V6), DevStudio wouldn't shut down properly.

    Thanks to Jeff Rockwell for bugging me from day 1 to track it down and Itay Szekely who recently brought it to my attention.

    Again, I am really sorry this has been around for so long and only just fixed, but I RARELY spend time on this add-in.

    Update: (3rd February 2000)

    Bruce Mack suggested that I show the text the bookmark is actually is set to in the advanced tab (see screen shot above).  The new version will (should) read your all saved bookmarks file correctly.  The first time that you run this, you may not see the selected text in the tree control.  The tree control will get updated as and when files are opened/closed with the new add-in.

    Known Issues:

    There is one problem (actually it's a minor annoyance). Every time, the user hits save, the editor will scroll. The cursor will remain at the same place but the text scrolls (which can sometimes dis-orient users). There doesn't seem to be any good way of achieving this. :-

    Important:

    This add-in has been tested under Windows 95/NT and works for VC5. It has also been tested under Windows 95/NT running VC6 and it seems to be running. If however you have a problem please let me know.

    Kudos:

    • Matthew Ellis - for finding numerous bugs and many ideas for enhancements.
    • Jeff Rockwell - for pestering me to find a bug which had been there for a long time.
    • Itay Szekely - for finding and helping me track down the big bad bug (a.k.a feature).
    • Chris Maunder - for the Hyperlink control which I am sure many people have found it awesome.
    • Bruce Mack - for suggesting an enhancement.

    Thanks to everyone for using this add-in and for the time taken to e-mail me with useful comments and suggestions.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralVB6 Pin
    dandraka6-Apr-08 23:42
    dandraka6-Apr-08 23:42 
    QuestionPorting for EVC 4.0 Pin
    Koderiter28-Sep-07 7:45
    Koderiter28-Sep-07 7:45 
    I have been trying to get this Add-in to work with EVC 4.0, but I'm running into troubles with the AddBookMarks function, In this function there is the following code:

    CComPtr<IDispatch> pDocsDisp;
    VERIFY_OK(m_pApplication->get_Documents(&pDocsDisp));
    if(!pDocsDisp)
    {
    return S_OK;
    }
    CComQIPtr<IDocuments, &IID_IDocuments> pDocs(pDocsDisp);
    if(!pDocs)
    {
    return S_OK;
    }

    The problem is that the pDocs never is set, it is always NULL therefore never moving on.
    I'm not a COM programmer, but thought I would try and get this to work, but having difficulties.

    Does anybody know if there is an alternate way to get the pDocs variable initialized so the rest of the function can work?

    I have debugged this and it looks like all the variables going [in] to the constructor are good, just the constructor fails.

    Thanks I hope to use this with EVC it would be so nice!



    Koderiter
    Generalsuggested change Pin
    samboy5119-Sep-06 15:01
    samboy5119-Sep-06 15:01 
    GeneralRe: suggested change Pin
    Wrangly9-May-07 3:32
    Wrangly9-May-07 3:32 
    GeneralLoading from VS6 under XP failed Pin
    Mischdad10-Feb-05 22:00
    Mischdad10-Feb-05 22:00 
    GeneralRe: Loading from VS6 under XP failed Pin
    umeca7415-Mar-18 4:31
    umeca7415-Mar-18 4:31 
    GeneralDebugging Add-In Pin
    Anonymous24-Oct-02 7:01
    Anonymous24-Oct-02 7:01 
    GeneralRe: Debugging Add-In Pin
    Anonymous24-Oct-02 9:05
    Anonymous24-Oct-02 9:05 
    QuestionDo you plan to convert this Add-In for .NET? Pin
    Jack Modulator10-Sep-02 5:36
    Jack Modulator10-Sep-02 5:36 
    AnswerRe: Do you plan to convert this Add-In for .NET? Pin
    J Patel10-Sep-02 9:50
    J Patel10-Sep-02 9:50 
    AnswerRe: Do you plan to convert this Add-In for .NET? Pin
    Anonymous24-Oct-02 9:08
    Anonymous24-Oct-02 9:08 
    AnswerVS.net bookmarks and breakpoints Pin
    Andrew Phillips27-Oct-03 14:15
    Andrew Phillips27-Oct-03 14:15 
    GeneralBrowser Highlighting Pin
    Mr Matt Ellis, Esq2-May-00 5:39
    Mr Matt Ellis, Esq2-May-00 5:39 
    GeneralGreat add-in! Pin
    Tom Hunter20-Jan-00 23:27
    Tom Hunter20-Jan-00 23:27 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.