PRB: Compiled In-Process Server Used Before IDE Server (149049)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows 4.0
- Microsoft Visual Basic Enterprise Edition, 32-bit, for Windows 4.0
This article was previously published under Q149049 SYMPTOMS
A request for an object provided by both a compiled OLE server dynamic-link
library (DLL) and an instance of the OLE server running in the Visual Basic
for Windows integrated design environment (IDE) is filled by the compiled
DLL.
WORKAROUND
It is possible to test the execution of what will become an OLE DLL in the
IDE when you have a previously compiled DLL. To accomplish this
functionality temporarily unregister the previously compiled DLL using
Regsvr32.exe. Then reregister the DLL by using Regsvr32.exe. For example:
Unregister the previously compiled DLL as follows:
regsvr32.exe -u DLLName.DLL
Reregister the DLL as follows:
If you make a new DLL while still working, Visual Basic for Windows
registers it when the DLL is made with the "Make OLE DLL" command.
Steps to reproduce problem- Start an instance of the 32-bit edition of Visual Basic 4.0 for Windows.
- Click Class Module on the Insert menu to add a class module to the
project.
- Change the following properties on the new class module to the
following:
Instancing: 2 - Creatable Multiuse<BR/>
Public: True
- Add the following code to the class module:
Public Sub Test()
MsgBox "In DLL"
End Sub
- Click Module on the Insert menu to insert a new code module.
- Add the following code to the code module:
Public Sub Main()
'do nothing
End Sub
- Click Options on the Tools menu to open the Options dialog box. Switch
to the Project tab and change the following settings:
Startup Form: Sub Main
Project Name: DLLandIDE
Startmode: OLE Server
- Click "Make OLE DLL File..." on the File menu to create a compiled OLE
DLL.
- Click Options on the Tools menu to again open the Options dialog box.
Switch to the Project tab and type in the name of the DLL generated in
step 8 in the Compatible OLE Server text box.
- Click "Make OLE DLL File..." to recompile the DLL.
- Change the line of code in the Test subroutine contained in the class
module from "In DLL" to "In IDE."
- Press F5 or click Start on the Run menu to run the server in the IDE.
- Start another instance of the 32-bit edition of Visual Basic for
Windows, and add the following code in the Form_Click event to the
default form, Form1:
Private Sub Form_Click()
Dim MyObj As Object
Set MyObj = CreateObject("DLLandIDE.Class1")
MyObj.Test
End Sub
- Step through the code in the client program and see that the text of
the message box displayed by the Test method contains "In DLL" and not
"In IDE."
Modification Type: | Major | Last Reviewed: | 6/28/2004 |
---|
Keywords: | kbprb KB149049 |
---|
|