Article ID: 199315
Article Last Modified on 11/21/2006
void MyTest::Boo(BOOL FAR* p1);
class MyTest : public CCmdTarget
{
// ... other stuff
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(MyTest)
// ... other stuff
//}}AFX_DISPATCH
afx_msg void Boo(VARIANT_BOOL FAR* p1);// USE VARIANT_BOOL and
// MOVE OUT OF AFX_DISPATCH BLOCK!
};
In the .cpp file of MyTest class:
void MyTest::Boo(VARIANT_BOOL FAR* p1) // USE VARIANT_BOOL!
{
// TODO: Add your dispatch handler code here.
}
In the project's .odl file:
// ... other stuff
dispinterface IMyTest
{
// ... other stuff
methods:
// NOTE: ClassWizard maintains method information here.
// Use extreme caution when editing this section.
//{{AFX_ODL_METHOD(MyTest)
// ... other stuff
//}}AFX_ODL_METHOD
[id(1)] void Boo(VARIANT_BOOL* p1);// USE VARIANT_BOOL and MOVE THIS
// OUT OF AFX_ODL_METHOD BLOCK!
};
void MyTest::Boo(BOOL FAR* p1)
{
// TODO: Add your dispatch handler code here
*p1 = TRUE;
}
Private Sub Command1_Click()
Dim a As Integer
Dim b As Boolean
a = 123
b = False
Set test = CreateObject("AutoObj.MyTest")
test.Boo b
Debug.Print a, b '<--- a is 0 - MEMORY IS TRASHED!
End Sub
Additional query words: kbDSupport
Keywords: kbautomation kbbug kbfix kbnoupdate KB199315