How do I reference a class from an EXE project?
VB6 does not allow you to add a reference to an ActiveX Exe (your ProjectB) from a project (ProjectA) that is loaded into the same IDE (project group). You get the error displayed when you try.
This is because an ActiveX Exe runs as a separate process, which I believe the VB6 IDE isn't capable of doing for separate projects in a group. So while it looks like you are adding the reference to ProjectB exe, since it's in the group, VB6 is actually adding a reference to ProjectB vbp, which isn't supported.
You need to remove ProjectB from your group. Then you'll be able to reference the ProjectB Exe from the ProjectA IDE.
If you need to run ProjectB in the IDE (for debugging or development), then first start VB6 and load ProjectB. Then start a second instance of VB6 and load ProjectA. When you start ProjectB, you'll notice that the reference in ProjectA changes from the ProjectB Exe to the ProjectB vbp (running in the second IDE). Set breakpoints in ProjectB as appropriate, then when you start ProjectA and instantiate ProjectB and make the method calls, you'll be running the ProjectB code in that IDE.
(NOTE - I've revised part of this)
As for the VB6 projects inside the group, you should be able to add mutual references to other projects in the group using the usual References window, EXCEPT TO EXE projects.
I tried this with a pair of test EXE / DLL projects, and when I try to add the EXE reference within a group I get an error:
(test1.vbp can not be referenced because it's project type is EXE.)
However I can reference the compiled EXE without issue from the DLL project. This may be your best way forward.
In order to register a compiled EXE, VB6 will do this for you when you compile it, but there was also a manual method which I eventually remembered - you need to run the .EXE
itself using the /regserver
switch.
Assuming that your .VBP already has the correct entries (basically, a reference line which points to the GUID of the EXE and/or some DLLs and OCX files) once you do this is should automatically find the classes in the EXE when you compile / run.
This is described in detali by several other SO questions so I won't repeat all that:
https://stackoverflow.com/a/211606/3195477
https://stackoverflow.com/a/4377190/3195477
https://stackoverflow.com/a/37931419/3195477
https://stackoverflow.com/a/1088289/3195477
https://stackoverflow.com/a/55459208/3195477
etc.
If you need to debug into the EXE from the group of DLLs, first make sure all the references are hooked up. Then you should be able to run the EXE project in the IDE, set breakpoints, and run the DLL group separately in another IDE instance and debug between them.