Microsoft KB Archive/223339

= FIX: onCOMRegister Not Called for VJ-Generated COM DLLs =

Article ID: 223339

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q223339



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 that this is a bug in the Microsoft products that are 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:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 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

</li> 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.

</li> 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

</li></ol>

<div class="references_section">