Goodday everybody...
I have a problem that hopefully someone outhere would be kind enough to help me...
Let me explain it with an example...
I created a ActiveX DLL in VB. The class name is CTest with a function name called Addition. This function receives two parameter and return a value of integer type:
Public Function Addition(x As Integer, y As Integer) As Integer
Now I want to use this DLL in VC++. I import this file into my project like this:
#import "C:\Pims-Program\GenDBDLL\FirstTest.dll" no_namespace
When I want to use the function,I write the following statements:
short x = 5;
short y = 6;
short z;
_CTestPtr m_pTest;
HRESULT hres = m_pTest.CreateInstance ( __uuidof(CTest) );
z = m_pTest->Addition(&x,&y);
When I compile the project, there's no error. But when I run it, the program will terminate during the function calling statement. Error below will occur:
Debug Error!
Program: C:\TESTVBDLL\DEBUG\TESTVBDLL.EXE
abnormal program termination
(Press Retry to debug the application)
When I press the Retry, the following error message will appear:
This program has performed an illegal operation and will be shut down.
So, my question is: what's wrong with my program and how can I rectify it?
Your help would be appreciated.... Thanks
