I acquire consistently admired to assay adapted brands of swiss fake watches affluence watches. If comparing the above brand, there are replica watches uk not abounding differences you can accretion distant from the above of replica rolex uk the replica. You can accretion some of the best Patek Philippe replica watches and acquire abolishment to rolex replica say added than your architectonics or you could accretion bigger above and a lower replica hublot watches casting and achieve your best easier.

BookmarkSave Addin for VB6 — Visual Basic Feng Shui

BookmarkSave Addin for VB6

Filed under VB6

EDIT: I’ve finally gotten around to publishing the source for this addin on CodePlex.

https://bookmarksavevb6.codeplex.com

EDIT 7/25/2012: I’ve just updated the addin (see the ZIP download below) to correct a problem that can occur if you have several projects loaded in a group, and have files of the same name loaded in each project, AND you set bookmarks or breakpoints in those files. In that case, the breakpoints/bookmarks can end up being restored to the wrong file when you load the group of projects. This won’t cause any problems in your code, but your bookmarks and breakpoints won’t be restored properly, and you might receive messages saying that “a breakpoint can’t be set on that line”, or something similar.  Just download the latest version, unzip it and copy the dll over your existing dll.

If first blogged about this addin back here.

Essentially, the idea is to solve a long standing pet-peeve of mine with the VB6 IDE; the fact that it doesn’t save your bookmark or breakpoint locations from one run to the next.

Ugh!

That functionality wouldn’t have taken more than about 30 minutes for someone to implement on the VB team, but, alas, no one did, and I’ve spent far more time than I should have manually restoring breakpoints ever since.

If, like me, you’ve worked in VB.net for any amount of time, and you now find yourself, from time to time, having to load up your trusty copy of VB6 to do some maintenance work, you, almost certainly also like me, sorely lament that missing functionality.

But no more!

After quite a bit of teeth-gnashing, along with some very helpful testing comments from Sam (Thank You!), I think it’s about time to correct that long-suffered oversight!

Download the Addin here:

BookmarkSave Addin ZIP

The Zip file contains one DLL. Just extract it where-ever you want, and run REGSVR32 on it (just like any other COM dll).

NOTE: You will have to have the .net framework 4.0 installed, as this addin is compiled in .net against that version of the framework. Why, you may ask? Well, frankly, VS2010 is much nicer to code in than VB6, and I was actually quite curious whether a VB6 Addin that performed a real, useful, function could be written in VB.net and act, more or less, just like an addin that had been written in VB6. Personally, with this, I think the answer is a pretty deafening “Oh Yeah!”…

DISCLAIMER: As with anything else around these parts, your mileage may vary (the normal “It works on my machine”). I’ve tested it in conjunction with a few of the addins I use (CodeSmart and MZTools, as well as the Mouse Wheel fix, and resource editor) and have had only one minor issue. If CodeSmart is loaded  as well as BookmarkSave, CodeSmart causes the VB6 IDE to crash when you unload it, but only if you ran your application in the VB6 IDE. If this scares you, don’t download or install this addin. I worked around a number of CodeSmart “peculiarities” concerning the way they happen to subclass VB IDE code windows, but so far, the source of this problem eludes me. The good news is that other than the Crash dialog, there doesn’t appear to be any other anomalies (your project saves fine, runs, etc). My suspicion is that during the Addin UNLOAD phase of the VB6 shutdown process, a pointer isn’t being released quite right.

Using the Addin

Well, it can’t get much simpler. Once you’ve registered it, load up VB6 and check the Addins Manager to make sure it’s loaded.

If it is, load up a project of your choice, set a few breakpoints and bookmarks, and close the project.

Reopen it in VB6 and you should see all your breakpoints and bookmarks wondrously reset just like they were before!

There aren’t really any settings or options to speak up.

Bookmarks are saved into an XML file called {projectname}.BM in the same folder as your project’s VBP file.

Breakpoints are saved into a {projectname}.BP file in the same place.

Naturally, you should probably not check those files into version control.

New Hotkeys

Sadly, VB6 doesn’t provide many convenient ways of navigating bookmarks and breakpoints, so this addin adds a few.

Ctrl-K – Toggle a bookmark at the current cursor location

Alt-Left or Right – Navigate to the next or previous bookmark

Alt-Up or Down – Navigate to the next or previous breakpoint

These aren’t configurable at this time.

A few interesting bits

None of this is necessary to actually use the Addin, but I’ll mention it for the curious:

First, I make use of my DLLExport utility to actually export the DLLRegisterServer and DLLUnregisterServer functions, so that the DLL can self register with COM, just like a VB6-authored DLL can. With all the other great COM support in .net, this is a really glaring omission. I wrote about that technique here.

Next, I use my “GenerateLineMap” utility to strip line number info from the PDB file and embed it into the DLL. This information is then used during error handling to annotate any stack trace with real source code line numbers, without actually including the PDB as a separate file. This is a technique I’ve worked on for quite some time, and talked about here, here, and here. Still need to get that article written up.

74 Comments

  1. Bruce Airy says:

    Hi Darin,
    I know VB6 is old and has problems but I have used it a good part of my career and still go to it for making quick utilities. I am retired now but I still dabble in programming. I used to have a program which would generate an automatic flowchart of a VB6 method using Nassi-Shneiderman Diagrams, I have modified it to work as an Add-in in VB6. I can click on a method and it will generate a flowchart of that method. I can click on a place on the flowchart and go to the source. But I would like to do other IDE things like single step through the flowchart, set/clear breakpoints, etc. I noticed you wrote your VB6 add-in in VB.net. Is there any way in your understanding to do a VB6 add-in in VB6 which can get and set breakpoints? I currently do not have VB.net at home. When I tried to install VB Express 2015, it would not open your add-in project I guess because Express is a rundown version. Thanks for any thoughts you can give me.

  2. pix says:

    I just found this after having to come back to VB6 and being forcibly reminded that bookmarks and breakpoints are not saved. Installed on Win 2003 server 32 bit just fine. Thank you!

  3. 植毛手術は、髪の毛が薄い人には、劇的な見た目の変化が期待できるので大人気です。ただ優秀な施術者にオペを依頼しないと思ったような成果は期待できません。カツラに比べて、合計のコストも安くなるのでお得な薄毛治療と言えます。

  4. Eamon Hynes, protection insurance expert at Beat – That – Quote.
    Health is the metabolic efficiency in all people and beauty brings joy to the
    beholder. Also the cleaning companies can provide you the
    pest control Woking services as well.

  5. office 2013 says:

    When the face in the mirror changes back to the one you have in this life or
    you become tired, begin writing down all of your impressions and the answers to your questions if your are journaling to record the
    experience. Every 11 years there is a pole reversal in the sun, which is peaking now, which causes massive solar flare ups.
    The Windows 7 Home Basic could support the unlimited applications, enhanced visual experience without Aero effect,
    advanced network support and Mobility Center.

  6. I got this website from my buddy who told me concerning this website and now
    this time I am browsing this web page and reading very
    informative posts here.

  7. abhijit says:

    Very use full addin

  8. Genberally I don’t read post on blogs, however I wish tto say that this write-up very
    pressured me to try and do it! Your writing taste has been surprised me.
    Thank you, very nice post.

  9. Tom says:

    Darin,

    Thanks for this add-in! Am I missing something though? The Toggle Bookmark icon in the Edit toolbar is disabled while in debug mode, so I can’t add/remove bookmarks while in debug mode.

    • Darin says:

      Just loaded it up and gave it a try. You can set breakpoints in Debug mode, but you’re correct, you can’t set bookmarks.

      I don’t believe that’s a limit of the addin though. That’s a VB IDE thing unfortunately.

      • Fernando says:

        I’m with this problem too… disabling your add-in, the toggle bookmarks button works on run time…
        I really liked your add-in… does has any way to fix this issue?

        Thanks!!
        Fernando

  10. Brian Baker says:

    Would be great if you could update the download on CodePlex to the latest version (1.0.0.7).

  11. Alex says:

    This is really a nice add in. Thank you so much!

    Is there a possibility that I hook an event for the standard bookmark toolbar buttons, so that I don’t have to use the hotkey [k] + [CTRL]? Thank you very much.

    • Darin says:

      The VB6 toolbars have to be hooked via the vb6 ide addin functionality. Unfortunately, it’s been a while since I’ve checked into that stuff.

      If you come up with something, my all means let me know and I”ll fold it into the addin.

      I’m not sure when I’d be able to get to that kind of mod.

      • Alex says:

        Hi Darin,

        thank you for your answer.I have already achieved this by adding some code. Maybe someonelse are interested in it:

        OnConnection:

        ‘ add event for the toolbar button Lesezeichen ein/aus
        _btnToggleBookmarkHandler = _VBInstance.Events.CommandBarEvents(_VBInstance.CommandBars(“Bearbeiten”).Controls(“&Lesezeichen ein/aus”))
        _btnDeleteAllBookmarkHandler = _VBInstance.Events.CommandBarEvents(_VBInstance.CommandBars(“Bearbeiten”).Controls(“&Alle Lesezeichen löschen”))

        _btnToggleBreakpointHandler = _VBInstance.Events.CommandBarEvents(_VBInstance.CommandBars(“Debuggen”).Controls(“Haltepunkt &ein/aus”))

        Private Sub _btnToggleBookmarkHandler_Click1(ByVal CommandBarControl As Object, ByRef handled As Boolean, ByRef CancelDefault As Boolean) Handles _btnToggleBookmarkHandler.Click

        Call BookmarkToggle(CommandBarControl, handled, CancelDefault)

        End Sub

        Private Sub _btnDeleteAllBookmarkHandler_Click(ByVal CommandBarControl As Object, ByRef handled As Boolean, ByRef CancelDefault As Boolean) Handles _btnDeleteAllBookmarkHandler.Click
        _VBInstance.VBProjects.ClearBookmarks()

        ‘ Alexander Hofmann 20131108
        ‘ Lesezeichen auch aus der Anzeige entfernen
        If Not frm Is Nothing Then
        If Not frm.treeOptions.SelectedNode Is Nothing Then
        If frm.treeOptions.SelectedNode.Name = “ndBookmarks” Then
        frm.lvwBookmarks.Items.Clear()
        End If
        End If
        End If
        ‘ Alexander Hofmann 20131108 END
        End Sub

        Private Sub _btnToggleBreakpointHandler_Click(ByVal CommandBarControl As Object, ByRef handled As Boolean, ByRef CancelDefault As Boolean) Handles _btnToggleBreakpointHandler.Click
        If CommandBarControl.enabled Then
        Call BreakPointToggle()
        End If
        End Sub

  12. Alex says:

    I get problems with getting the HHookID with my .Net 4.0 Framework. I added the following into the KeyboardHook.vb and it works. Maybe someone helps…

    Public Class KeyboardHook

    Public Shared Function GetModuleHandle(ByVal lpModuleName As String) As IntPtr
    End Function

    and instead

    HHookID = SetWindowsHookEx(WH_KEYBOARD_LL, KBDLLHookProcDelegate, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)

    use this
    ‘ In .NET 4.0, SetWindowsHookEx returns 0, because of this, we use GetModuleHandle
    HHookID = SetWindowsHookEx(WH_KEYBOARD_LL, KBDLLHookProcDelegate, GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName), 0)

  13. Jason says:

    This is just not working for me. I have registered the dll with regsvr32 in syswow 64 and the addin is loaded in the addin manager of vb6. It even generates the associated files but when I set a breakpoint, it doesn’t get saved. I open the project again and the breakpoints are gone. I’m running 64 bit Windows 8. What am I doing wrong?

    • Darin says:

      I’m not sure. I’m running 64bit win7 and it works a treat there.

      You should end up with a .bm (for bookmarks) and a .bp (for breakpoints) files in the same folder as your VBP file.

      The bm and bp files are pretty simple XML files. If you don’t see them, it could be a rights issue.

      If they are there, are they readonly? (some VCSs will write protect files when you check them in).

  14. Spiros says:

    Thank you very much for this add-in! Tired of setting the same bookmarks again and again!

  15. Diogo says:

    Thanks for this Add In =)

  16. David A. Belliveau says:

    If you are running VB6 Pro IDE on Windows 7 Pro x64 (there is a way to do that, BTW), then this BookmarkSave.dll add-in works fine on that configuration, in case anyone was curious. DAB

  17. Jean-Claude Piron says:

    Hi Darin,

    It would be nice to run your addin in VBA. I registered the Dll but I don’t see it in VBA Add-in Manager (I’m working in Esri ArcMap 8.3). What can I do?

    With VB6 SP6 in french, I get this error message when VB6 is run:
    —————————————————————————————-
    Error:
    There was an error trying to initialize one or more of the Menu Bar buttons!

    Scope:
    The last operation you attempted has failed and wasn’t performed.

    Action:
    You should attempt the operation again. If that fails, unload and restart Bookmark Save.

    Details:
    The original exception text was ‘Value does not fall within the expected range.’
    No further information is available.
    If the problem persists, contact Bookmark Save.

    Basic technical information follows:

    Date and Time: 16/10/2012 09:44:06
    Machine Name: 7CSBT3J
    IP Address: 10.108.96.159
    Current User: FINBEL\jcpiron

    Application Domain: DefaultDomain
    Assembly Codebase: file:///C:/WINNT/SYSTEM32/BOOKMARKSAVE.DLL
    Assembly Full Name: BookmarkSave, Version=1.0.0.7, Culture=neutral, PublicKeyToken=null
    Assembly Version: 1.0.0.7
    Assembly Build Date: 25/07/2012 12:50:02

    —- Stack Trace —-
    Microsoft.Office.Core._CommandBars.get_Item(Index As Object)
    BOOKMARKSAVE.DLL
    BookmarkSave.Application.InitMenuSink(MenuToSubClass As String, SubMenuTopID As Int32, SubIDSubName As String)
    BOOKMARKSAVE.DLL: Source File – …\darin\bookmarksave\application.vb: Line 0251: IL 00000
    —————————————————————————————————
    What’s the problem?

    Thanks in advance.
    JC Piron

    • Darin says:

      Hi JC

      My apologies for the (very) late reply. For some reason, I didn’t get notification emails for some time when people would post and I just never saw these posts.

      Anyway, about your question.

      I’m not sure the addin would even work properly in a VBA environment. It might, but it might take some work to get it there, and unfortunately, I just don’t have the time to dig into it at the moment. Feel free to download the code and see what you get get working. It’s fairly straightforward stuff, although the part that effectively “reads the screen” for those little red dots that VB uses to mark breakpoints might be a little peculiar (and that part might need work to support VBA if the screen layout changed much.)

      • Patis says:

        Good morning Darin

        Sorry that I bother again. I’ve read the posts below to recompile a german version of the Addin. My problem is that i can’t find your “GenerateLineMap.exe”. It’s mentioned in a post below and you wrote there that it’s in a post above. I’ve browsed alot, but unfortunately i couldn’t find it.

        Can you explain me please, where i can get it?

      • Alex says:

        I have the same problem. I tried to recompile it for my german VB6 IDE, but I didn’t found the “GenerateLineMap.exe”.

        • Darin says:

          The GenerateLineMap utility basically is used to embed debugging line numbers into the deliverable EXE. If you don’t run it, you won’t get nice, line numbered stack traces if there’s an error, but other than that, you don’t really need it. Just remove the execution of it from the build process and you should be good.

          Sorry it took so long to comment about that.

  18. I get an error when the addin tries to start:
    04.09.2012 12:16:38 – System.ArgumentException: Value does not fall within the expected range.
    at Microsoft.Office.Core._CommandBars.get_Item(Object Index)
    at BookmarkSave.Application.InitMenuSink(String MenuToSubClass, Int32 SubMenuTopID, String SubIDSubName) Msg: There was an error trying to initialize one or more of the Menu Bar buttons! Details:

    I use a german version of VB6.

    • Steffen says:

      I recompiled with german menu names and it works for me!

      • Sergej says:

        Hallo,
        könnten Sie bitte die von Ihnen kompilierte DLL mit deutschen Menünamen an meine E-Mail senden oder hier posten?
        Vielen Dank im Voraus

        • Alex says:

          Mit diesen klappts bei mir endlich!!!
          For the German IDE
          ‘sink all necessary buttons on menus
          Call InitMenuSink(“Menüleiste”, 30165, “MenubarDebug”) ‘ (“Menu Bar”, 30165, “MenubarDebug”)
          Call InitMenuSink(“Bookmarks”) ‘ ‘Lesezeichen
          Call InitMenuSink(“Debuggen”) ‘ Debug
          Call InitMenuSink(“Bearbeiten”) ‘ “Edit”
          Call InitMenuSink(“Toggle”) ‘Toggle Lesezeichen ein/aus

      • Darin says:

        Hi Steffen

        Awesome. Glad to hear it!

        Darin

      • Alex says:

        Where did you get the GenerateLineMaps.exe utility? I try to do the same, but I get the error “The command “”GenerateLineMap.exe” /out:”bin\Debug\BookmarkSave.dll” “bin\Debug\BookmarkSave.DLLExportTrigger.dll” ” exited with code 9009.” and I didn’t found this exe. Solange ich das nicht fixen kann, kann ich die Dll anscheinend nicht selfregistern.

        Which changes you have made? I have only changed the “menutosubclassname”. Could you tell me if you made the same changes?

        Public Sub OnConnection(VBInst As VBIDE.VBE, ByVal ConnectMode As VBIDE.vbext_ConnectMode, custom() As Object)
        ‘—- make the VBE globally available
        _VBInstance = VBInst

        ‘—- Setup the exception handling stuff
        ExceptionExtensions.Initialize()

        ‘Do your initializing stuff here
        Try
        _MenuCommandBar = AddToAddInCommandBar(“Bookmark Save”)

        ‘sink the event
        _MenuHandler = _VBInstance.Events.CommandBarEvents(_MenuCommandBar)

        ‘sink all necessary buttons on menus
        Call InitMenuSink(“Menüleiste”, 30165, “MenubarDebug”) ‘ (“Menu Bar”, 30165, “MenubarDebug”)
        Call InitMenuSink(“Lesezeichen”) ‘ Bookmarks
        Call InitMenuSink(“Debuggen”) ‘ Debug
        Call InitMenuSink(“Bearbeiten”) ‘ “Edit”
        Call InitMenuSink(“Lesezeichen ein/aus”) ‘Toggle

        Catch ex As Exception
        ex.Show(“Failed to startup addin properly.”)
        End Try
        End Sub

        • Darin says:

          You don’t actually need the GenerateLineMap utility. It’s only used to embed line number info into a production build exe. Just remove it from the build process and you should be good.

          Sorry about the confusion.

    • Patis says:

      Hey everyone

      I’ve got the same problem as other guys, with the Menu Bar button’s.

      As i see on Steffens post it’s caused by VB IDE languages != english. How can i get the addin running with a german IDE? How could Steffen Recompile with german names, without the sources? Well i don’t see where i can get them. :)

      I’d really like to use that Addin.

      Thanks in advance.

  19. Nelson says:

    Darin, thank you for this great and long overdue add-in for VB6. Works great! Just one bug I was wondering if you could replicate and possibly please fix? I do not show the Edit toolbar in my VB6 environment. Instead I customize the Standard toolbar to show the bookmark icons in it. If I add a bookmark from the Standard toolbar, it seems your add-in is not catching it and thus not saved with my project. If I add the bookmark from the Edit toolbar, it works fine. Thank you very much for your time! Best Regards

    • Darin says:

      Interesting. I’ve never setup VB6 quite like that.

      I’ll give it a whirl and see what happens. That’s entirely possible, though. I have to intercept the Menu selection in order to be notified of the bookmark set.

      I’ll post back what I find out.

      Thanks!

      • Katsumi says:

        Another tip that doesn’t involve you chnnigag the way drag and drop works is to drag with the right mouse button instead of the left button. Then when you let go of the button at the destination folder, you will get a menu to Move, Copy or Cancel. I think this is as quick, if not quicker, than using clicklock.Plus it works in Outlook and Windows Explorer among other programs.

    • Darin says:

      Ok. just tried that out right quick, sure enough. It fails.

      Basically, I took a quick and dirty way out and I sink events from specific Menu and toolbar entries.

      When you create a new button on the STANDARD toolbar, but the button is, say “Toggle Bookmark” it’s still a different button than the Toggle Bookmark button on the Edit menu, and since VB doesn’t have the concept of sinking “Command events” but rather it allows you to sink “Button events” that means we’re talking about sinking 2 completely different events that none-the-less end up doing the same thing.

      To solve that, I’d need to wrap each menu and toolbar button in a wrapper that sinks all their various events in a single sink. Otherwise, you may have put the Toggle Bookmark on the Standard toolbar, but someone else might put it on several toolbars, and on a menu somewhere.

      It’s doable, but I’m swamped with other thinks right now, so for the time being, I suspect your best bet is to just turn on the edit toolbar and tuck it away over on the side. I’ll see what I can do though.

      • Nelson says:

        Darin, thank you for the prompt reply. I’ve downloaded the source code from the CodePlex link, but it seems to be build 6 (and the downloaded release DLL is build 7) – so not sure the latest source code is up there. I’ve looked at the code and am trying to understand it. I see a definition Public WithEvents _Edit_BookmarkToggle As CommandBarEvents which is later used down in a Select Case statement where there is a Case “Edit”. Would we need a new one for the “Standard” toolbar? However, as you said, others can add the bookmark icons to other menus and you don’t want to have to code for each one. I’m not sure on how to “single sink” these in a wrapper. There is no rush, but perhaps I can help out if you’d like. Let me know. Thanks again.

        • Darin says:

          Oops. Yeah, forget to upload it but when I go to CodePlex tonight, the source repo appears to be down.

          I’ll upload as soon as Codeplex comes back online. Sorry about that.

        • Darin says:

          Codeplex is back up, so I’ve uploaded the source changes for v 1.0.0.7.

          Give it a shot now.

          If you make any changes, i’d love to see what you end up with!

          • Nelson says:

            Thank you Darin. I loaded up the project, but it seems I can’t run it as I’m encountering a few issues. First I had 13 errors stating that “Type CommandBarControl is not defined.” I referenced in Microsoft.Office.Core (not sure if this is correct or not – it seemed to resolve it (but I only have Office 2007 installed on this box), but now it’s stating 2 warnings and one error (which is regarding that reference) as follows:

            Warning 1 Cannot get the file path for type library “2df8d04c-5bfa-101b-bde5-00aa0044de52″ version 2.5. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) BookmarkSave

            Error 2 The command “”DLLExport.exe” /Debug /verbose /input:”obj\Debug\BookmarkSave.dll” /output:”bin\Debug\BookmarkSave.dll”" exited with code 9009

            Warning 3 The referenced component ‘Microsoft.Office.Core’ could not be found.

            Plus on this line it says it ‘can’t resolve symbol Control’:
            For Each SubMenuBar In MenuControl.Control

            Sorry to bug ya, but not sure if there is something else needed to run this project?

          • darin says:

            The proj requires refs to the com libraries for those vb6 functions, not .net refs.

            I’m actually away till Mon. but when I get back I can give you better info on that

          • Darin says:

            Ok. Back in place now.

            About the references.

            You’ll need a ref to the VB6 VBIDE.DLL. That’s a pretty straightforward one.

            There IS a reference to the Microsoft.Office.Core library,but that’s actually a reference to the PIA (Primary interop assembly) for the base MSOffice library, which is COM. This is for access to the interfaces for the CommandBarButton, etc objects.

            Any version of office should work for that. Ideally, you should reference a PIA (it’ll be installed with most newer versions of office)

            for older versions, you can download and install the PIA assemblies.

            For instance, here’s the one for Office 2010

            http://www.microsoft.com/en-us/download/details.aspx?id=3508

            To completely compile it as is, you’ll need my DLLExport.exe utility. See here

            http://www.vbfengshui.com/exposing-c-style-entry-points-in-a-net-assembly-revisited/

            You’ll also need my GenerateLineMaps.exe utility that I mention in the post above.

            They’re both quite easy to use. Just put them on the path somewhere and let them do their magic!

  20. Steve Barnett says:

    Have you tried this with a VB group? I seem to be having a problem when I open a vbg with three projects in it. One of those projects has breakpoints and the other two do not.

    When I open the vbg, it restores the breakpoints for me but then issues a load of ‘breakpoint not allowed on this line” messages. It appears to be applying the breakpoints from the one project with breakpoints to the other two projects without them .

    Any suggestions?
    Thanks

    • Darin says:

      Hi Steve,

      Yes, I use it with VBG’s all the time.

      One thing that can get you. If the BM or BP files get marked read only, the addin just silently ignores that.

      If you then change the source, the BM or BP entries won’t point to the same lines of code anymore, and, likely as not, you’ll get those VB errors you describe when The bookmarker tries to set breakpoints to invalid code locs.

      The same can happen in reverse, and this DOES happen to me from time to time.

      If you edit the source OUTSIDE of the VB ide, then load it up, if the lines of source changed such that the old breakpoints don’t sit on valid code, you’ll get those errors.

      Not much I can do about that situation. The best thing to try is to delete all your BM and BP files (they’ll be right beside the VBP files in your project), and start over.

      One final note, bookmarksave doesn’t currently “detect” that it failed to restore a bookmark (doing so it not trivial), so if the source changed or whatever, and a bookmark/breakpoint becomes invalid, it’ll “stick around”, and even if you add new bps, the invalid one will still be persisted. You have to clear it out manually.

      The easiest way is to just delete the BP file (with VB NOT loaded), but you can also just select the CLEAR ALL BREAKPOINTS menu item in vb as well.

      • Steve Barnett says:

        Strange. I deleted the .bm and .bp files and got no messages, as expected. I then added a single breakpoint to a form and closed/reopened VB. I got my breakpoint back and one error too.

        Thing is, the form I added the breakpoint to is called frmMain and the form that had the error was also frmMain, but was in a different project. That can’t just be coincidence, surely?

        • Darin says:

          Ah, I don’t think I’ve had that situation with my projects.

          I’ll set up a test and see what happens. it could be I’m somehow not ending up on the right form when restoring the bps.

          • Steve says:

            Much appreciated. The projects I work on a rather large and have a tendency to do very strange things… Usually just after you establish the exact set of breakpoints you need!

        • Darin says:

          Ok. Looks like it was a case of a typo, should’ve used VBProject and not ActiveVBProject (doh!). Not sure how that got missed, but none the less.

          I’m going to do some testing here to make sure that resolves it and post the update back to this page…

          Thanks for the heads up!

          • Steve says:

            Excellent. I cannot thnk you enough for this.

          • Darin says:

            There’s an updated DLL in the ZIP attached to this post. Just download, unzip and copy the new dll over the old one. You shouldn’t even have to register anything (assuming the old one was registered and working in VB before).

          • Steve Barnett says:

            Works like a dream. Thank you.

          • Darin says:

            Fantastic!

            Thanks for letting me know

  21. Darin says:

    Finally got around to posting the source on CodePlex. If you’ve got GIT or MERCURIAL, head on over and fork it.

    https://bookmarksavevb6.codeplex.com/

  22. JBATES says:

    Nice Add-in Waiting for the Source, I’d like it to be able to go to a breakpoint too.

  23. Mike Lyons says:

    Darin
    Just found this great tool 3/20/12 – quite useful for those of us doing legacy VB6.
    1) One issue I have is if you set breakpoints on a file that is read-only, then close the project and reload it, that read-only file code window flashes on and flashes off very quickly. (Code windows loaded based on VBW file settings?!?) If I then double-click on that file in a normal manner from the Project window, then the code window loads up and the breakpoints and bookmarks are properly shown (based on your BP/BM file). Is there any way this can be fixed in your add-in? Maybe all you have to do is read the related Project Workspace VBW file for the x-y coordinates of that window to force read-only files with breakpoints/bookmarks to load/display?
    2) I am now thinking of doing something similar as an add-in so that any Watch window entries can also be reloaded. Any hints on how I could do this? (I loaded the MS SPYXX utility and the window class is “VBAWindow”.)

    • Darin says:

      I apologize for taking so long to comment. It appears my email notification is borked somehow.

      At any rate, I’ll have a look at that, as it’s something I haven’t noticed lately (I’m using subversion at the moment for VCS and nothing is ever readonly with it).

      Preserving Watches would +definitely+ be nice, but that’s a whole other realm of complexity. Just getting access to the Watch definitions would be tough. However, you may be on the right track. If the Watch window uses any kind of grid that can be queried via messages, you theoretically could retrieve the content of the grid items. But that’s a complete guess.

  24. Darren, thanks, this is brilliant. Works perfectly.

    Like you I’ve just had to pick up and old VB6 project and I’d forgotten quite how painful the IDE was.

    Would you consider releasing the source? I plan to write an addin to provide the perplexingly missing “go to line number” functionailty; your addin seems like it might be a good place to start.

    I would of course release my addin and its source for others including yourself to use.

    • admin says:

      Hi Chris

      Glad to hear it’s working for you. Yes, I do plan on opening up the source. Just hadn’t gotten to the point of cleaning it up yet. I’ll give it a run through and post back here.

      I’ve also run into a couple issues I need to sort out as well, the primary one being that if you use the Alt-Up/Down to attempt to navigate through breakpoints while in run mode, the addin crashes. It doesn’t take down VB, so that’s good, but it shouldn’t crash either. I’m guessing it’s just a limitation of somethat that VB6 can’t do in run mode, but I’ll have to look into it further.

      Did you see my post about VB6 addins written in .net?
      http://www.darinhiggins.com/authoring-vb6-ide-addins-in-vb-net/

      That also might be a good starting point for a “Goto line number” addin.

      • Yes, your .Net tutorial looks very good. Definitely sounds the way to go. Plus it means not having to use the VB6 IDE. Thanks.

      • Just completed the Go To Line number addin; once I looked into it it was very easy. I’ve got some other functionality I’d like to add then I’ll release the addin as a collection of utilities.

        I was wondering if you had any pointers about how to integrate keyboard shortcuts into an addin. It doesn’t look as if the Office.CommandBarControl control exposes any keybindings.

        Do I have to subclass something, perhaps?

        • Darin says:

          Hi Chris

          Yeah, they didn’t make keyboard handling easy in Vb6. For app wide shortcuts, as I recall, you pretty much have to setup a global keyboard hook and then filter for keystrokes that happen only when a window you care about has focus.

          Spyworks used to have a global hook component that could do that. It’s also possible without spyworks, but I’d have to dig through my archives to remember how.

    • Darin says:

      Ugh. I must have something completely wrong with my WordPress setup, I’m just not getting emails about comments left like this.

      Sorry for taking, well, forever to get back to you on this.

      Yeah, I’ve been bandying around the idea of open sourcing it for a bit now. I’ll likely make one more pass through the code, but yeah, my plan is to just release it.

      Stay tuned!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*