Search code examples
debuggingvb6esri

debugging vb6 form inside 3rd party application


I have to travel back in time and debug a VB6 form. It is used inside an application (not ours, Esri ArcMap.exe). I see VB6 has some debug capabilities, but nowhere do I see, like in .NET, the ability to "launch another app" or "attach" to a running application.

How can I debug my VB6 code while running inside a 3rd party application?


Solution

  • It's right there; you just didn't see it.

    If your form is hosted inside a DLL (most likely from your description), you have two options, both of which can be set from the "Project"-> "Projectname Properties" dialog box, Debugging tab.

    • "Wait for components to be created"
      When click on Run (F5), VB6 will alter the registry entries for your DLL so that they point to the VB6 debugger.
      Launch your third-party program as usual.
      When any program tries to create objects and forms hosted by your DLL, it will do so through the debugger.

    • "Start a program"
      Same as before, plus VB6 will execute the command line entered in the dialog box.

    It should be noted that VB6 must be run in full "As Administrator" mode, because it needs to write to normally-protected areas of the registry.

    Don't worry about the third option. Let's just say that some things are better forgotten.