Help and Support
 

powered byLive Search

FIX: ClassWizard Incorrectly Reads LPDISPATCH Params from .TLB

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:131044
Last Review:December 1, 2003
Revision:3.0
This article was previously published under Q131044

SYMPTOMS

ClassWizard generates improper COleDispatchDriver derived member functions for methods that contain one or more LPDISPATCH* parameters. Specifically, ClassWizard generates member functions using a LPDISPATCH parameter instead of LPDISPATCH*. In other words, the asterisk (*) is missing.

Back to the top

RESOLUTION

To correct this problem, you must edit the COleDispatchDriver derived member directly.

For example, assume there is a type library (.TLB file) for an object that supports a method that returns a void and accepts an LPDISPATCH* as its only parameter. When ClassWizard reads the .TLB file, it generates a new class from COleDispatchDriver. The method for the member function that returns a void and accepts an LPDISPATCH* parameter ends up with this incorrect definition:
   void ITestObject::TestMethod(LPDISPATCH lpDispPtr)
   {
      static BYTE BASED_CODE parms[] =
         VTS_DISPATCH;
      InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
         lpDispPtr);
   }
				
To correct this problem, change the parameter type to LPDISPATCH*, and modify the parms[] array so that it contains a corresponding VTS_PDISPATCH entry instead of VTS_DISPATCH, as illustrated here:
   void ITestObject::TestMethod(LPDISPATCH* lpDispPtr)
   {
      static BYTE BASED_CODE parms[] =
         VTS_PDISPATCH;
      InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
         lpDispPtr);
   }
					

Back to the top

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This was fixed in Visual C++ version 5.0.

Back to the top


APPLIES TO
The ClassWizard, when used with:
  Microsoft Visual C++ 1.5 Professional Edition
  Microsoft Visual C++ 1.51
  Microsoft Visual C++ 1.52 Professional Edition
  Microsoft Visual C++ 2.0 Professional Edition
  Microsoft Visual C++ 2.1
  Microsoft Visual C++ 4.0 Standard Edition
  Microsoft Visual C++ 4.1 Subscription
  Microsoft Visual C++ 4.2 Enterprise Edition
  Microsoft Visual C++ 4.2 Professional Edition

Back to the top

Keywords: 
kbautomation kbbug kbfix kbvc500fix kbwizard KB131044

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.