It appears that the VBKeySave5\
subtree is used by the VB6 IDE when running with multiple projects in a group.
When running in the group, VB6 cleverly makes all the COM references that normally be served from a compiled DLL actually redirect to the IDE, so you can debug right into projects in the same group. It seems to use the VBKeySave5\
subtree to implement some of this wizardry.
I made a test project which contained one test DLL. Then made a test group containing both. Using Process Monitor I spied on what the IDE was doing in the registry. This is the basic sequence of events:
- Load project group
- Run project group - debugging begins
- IDE creates the
VBKeySave5\
subtree
- IDE populates that subtree with a bunch of stuff
- Test program executes in the IDE / debugger
- Test program terminates
- IDE removes all the stuff under
VBKeySave5\
- IDE returns to edit mode (debugging ends)
In that scenario, nothing extra is left in the registry.
Now - if after step 5 I killed the VB6.exe process, all the registry junk it added never gets removed. And running VB6 again and running the same group doesn't clean it up -- it just creates slightly different stuff under VBKeySave5\
instead.
So over time, especially with larger projects, cases when the IDE terminates abnormally add tons of useless clutter to the registry. And it appears this clutter still has to be read through by the IDE when it loads the project, etc. slowing it way down.
In our case, for whatever reason the IDE crashes a lot. And we use project groups (with 4, 5, 6 projects) regularly. So it appears that these crashes junk up VBKeySave5\
with lots of entries, and that causes the slowdown.
Maybe there are also situations other than crashes where VB6 doesn't clean up after itself.
Additional information related to why VBKeySave5 might not be cleaned up automatically:
The VS Installer for Windows 10 allows you to set the VB6.EXE
compatibility mode to Windows Vista (Service Pack 2).
DO NOT DO THIS.
Do not run the VB6 IDE in compatibility mode of any kind. The
suggested purpose is to fix anomalies in the graphic designer of the
IDE. Believe me, these anomalies are nothing compared to the damage
left in your windows registry when VB6.EXE is run in compatibility
mode.
When VB6.EXE is used to Compile-And-Run your application, it replaces
GUIDs and class and typelib registrations causing them to refer to its
VB6DEBUG.DLL. this allows the IDE to intercept execution of your code
so you can debug. When it does this replacement of your DLL and OCX
registrations, it saves your stuff under HKCR\VBKeySave5.
Unfortunately, when VB6.EXE is set to run in compatibility mode of an
earlier verison of Windows, it fails to restore all of your DLL and
OCX registration information. It leaves VBKeySave5 there, which causes
your IDE to take much longer during subsequent starts of the IDE, and
it trashes your registry, eventually rendering your application
not-runnable on your machine.