FIX: onCOMRegister Not Called for VJ-Generated COM DLLs
ID: Q223339
|
The information in this article applies to:
-
Microsoft Visual J++, version 6.0
SYMPTOMS
The following error message is generated when trying to unregister a COM DLL that was created using Visual J++ 6.0 with a Service Pack less than Service Pack 3 where xxxDLL is the project name you used for the VJ6 COM DLL project:
RegSvr32
DllUnregisterServer in ...\xxxDLL.dll failed.
Return code was: 0x80040111
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
MORE INFORMATION
The above error happens only when the Visual J++ 6.0 COM DLL project contains the onCOMRegister method.
Note that the registry entry corresponding to this DLL gets removed when unregistering the DLL even though the unregister attempt causes the above error.
Steps to Reproduce Behavior
- Using Visual J++ 6.0, create a COM DLL Component by choosing File | New Project | Visual J++ Project | Components | COM DLL. Enter the name Project1 and select Open.
- Change the automatically-generated Class1.java file to look similar to the following example:
/**
* This class is designed to be packaged with a COM DLL output format.
* The class has no standard entry points, other than the constructor.
* Public methods will be exposed as methods on the default COM interface.
@com.register(clsid=09DD2F40-ED5E-11D2-AE39-00AA0060DAEF, typelib=09DD2F41-ED5E-11D2-AE39-00AA0060DAEF)
*/
public class Class1
{
public static void onCOMRegister(boolean unRegister)
{
if (unRegister)
com.ms.wfc.ui.MessageBox.show("Registering.");
else
com.ms.wfc.ui.MessageBox.show("Unregistering.");
}
}
Note that the @com.register line in the sample code above has the comment character removed.
- Build the DLL Project.
- A Message Box containing the text Registering is displayed. Running the following command should also register the DLL:
regsvr32 Project1.dll
If the regsvr32 command is used, a Message Box containing the text Registering is followed by a dialog, such as:
RegSvr32
DllRegisterServer in ...\Project1.dll succeeded.
- After registering the DLL, the following command will unregister your DLL:
regsvr32 /u Project1.dll
- If the DLL was compiled using Visual Studio 6.0 with a service pack less than Service Pack 3, unregistering the DLL generates the error:
RegSvr32
DllUnregisterServer in ...\Project1.dll failed.
Return code was: 0x80040111
- If the DLL was compiled using Visual Studio 6.0 with Service Pack 3 or greater, unregistering the DLL will cause a Message Box containing the text Unregistering to be displayed, followed by a dialog such as:
RegSvr32
DllUnregisterServer in ...\Project1.dll succeeded.
-
Note that attempting to unregister a DLL that is not currently registered produces an error dialog such as the following no matter which version of Visual J++ was used to create the DLL:
RegSvr32
DllUnregisterServer in ...\Project1.dll failed.
Return code was: 0x8000ffff
REFERENCES
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java,
please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
Additional query words:
Keywords : kbservicepack kbCOMt kbJava kbJavaVM kbVJ600fix kbGrpJava kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug