vc中调用VB的DLL
为什么我在VC中调用VB的DLL老是出现KERNEL32.DLL错误.
我是这样调用的.#include <stdio.h>
// This is the path for your DLL.
// Make sure that you specify the exact path.
#import "c:\project1.dll" no_namespace
void main()
{
BSTR bstrDesc;
try
{
CoInitialize(NULL);
short st = 2;
short st1;
// Declare the Interface Pointer for your Visual Basic object. Here,
// _Class1Ptr is the Smart pointer wrapper class representing the
// default interface of the Visual Basic object.
_Class1Ptr ptr;
// Create an instance of your Visual Basic object, here
// __uuidof(Class1) gets the CLSID of your Visual Basic object.
ptr.CreateInstance(__uuidof(Class1));
st1 = ptr->MyVBFunction(&st);
}
catch(_com_error &e)
{
bstrDesc = e.Description();
}
CoUninitialize();
}
在测试程序中运行良好可是一放到我的项目中就出现错误