VB6: Problem in Compiling an ActiveX ocx & ActiveX exe having circular ref.
I have a problem in compiling two VB projects that was delivered to us by a third party.
Here are the details:
Windows 2000 Server service pack 4
VB6 service pack 5
a. APScroll.vbp --> compiles to an ocx (AP.ocx)
b. DistroWindows.vbp --> compiles to an ActiveX exe (DistroWindows.exe)
The two projects have a circular reference, in that
1. APScroll.vbp creates a class CostDist, declared in DistrowWindows.exe and passes the reference of WFXShellUC to CostDist.
2. DistroWindows.vbp refers to a UserControl (Name: WFXShellUC) that is defined in APScroll.vbp
Here's the code in the user control WFXShellUC:
Public WithEvents d As CostDist.clsCostDistDlg
Set d = New CostDist.clsCostDistDlg
Set .ctlRef = Me
MsgBox ("Set Control Reference")
Here is the procedure I followed:
1. compile DistroWindows.exe
(refer to an existing ap.ocx)
2. Add project references to DistroWindows.exe compiled in step 1 in APScroll.vbp and compile APScroll.vbp to ap.ocx.
3. The compile in step2 fails with the link error saying "cannot replace object ap.ocx)
I guess the reason being DistroWindows.exe (added to project references of APScroll) intern refers to AP.ocx that we are trying to replace.
Any help in getting these two projects compiled is appreciated.
If needed I can email the two projects and dependent files.