The MFC wizard does not generate code for the methods that take a BYTE or BYTE* as a parameter
This article was previously published under Q241862 On This PageSYMPTOMS
When generating wrapper classes for a COM server that has methods that take a BYTE or BYTE* as a parameter, the MFC wizards do not generate code for these methods. The wizard does place a comment in the wrapper class header file that states that the method was not emitted due to an invalid return type or parameter type. Following is the exact text:
BYTE and BYTE* are both OLE Automation compatible data types, thus this message can be somewhat confusing.
CAUSE
This is due to bugs in ClassWizard and Component Gallery not recognizing BYTE and BYTE* as valid OLE Automation data types.
RESOLUTION
You can add the methods that were omitted manually. For example, given a method PassByte that takes a single BYTE parameter and another method PassBytePointer that takes a single BYTE* parameter, you could add the following code to the wrapper class in the wrapper class header file as follows:
Next, you need to add the code to the wrapper class source file. Given the example above, it should look like the following:
It is important to note that you need to get the DISPIDs for the omitted methods using a type library viewing tool. OLE/COM Object Viewer is one such tool. You can access this tool from the Tools menu in Visual C++. In OLE/COM Object Viewer, select the File menu and the View Typelib menu item. Next, find the .tlb or .ocx file for the COM server and click Open. This opens a new window with a tree control on the left side. Select the topmost item in the tree control and you will see all of the methods on the right with their corresponding DISPID's.
A second important point is that VTS_UI1 and VTS_PUI1 are not used above. For more informationon this bug, click the following article number to view the article in the Microsoft Knowledge Base: 242588 (http://support.microsoft.com/kb/242588/)
VTS_U1 and VTS_PUI1 are defined incorrectly in the AfxDisp.h header file
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. MORE INFORMATIONSteps to reproduce the behavior
REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
242588 (http://support.microsoft.com/kb/242588/)
BUG: VTS_UI1 and VTS_PUI1 are Defined Incorrectly in AfxDisp.h
In MSDN documentation, refer to CWnd::InvokeHelper and
COleDispatchDriver::InvokeHelper for more information on the parameters for these functions.
APPLIES TO
| Article Translations
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Back to the top
