描述:
import "oaidl.idl";
import "ocidl.idl";
[
uuid("EBCF2E5F-07AC-40a9-BE77-65BF567A8A47")
]
library MyLib
{
[
uuid("BF30B2EF-B113-4b4f-B7C0-92E424C999AB"),
dllname("mynet.dll")
]
module MyNetOp{
[
entry("StartUp")
]
void __stdcall StartUp(long hWnd);
[
entry("SignIn")
]
void __stdcall LogIn([in,string,max_is(255)]char *strUserName,
[in,string,max_is(32)]char *strPassword);
[
entry("SignOut")
]
void __stdcall LogOut(long nUserId);
[
entry("SendMobileMessage")
]
void __stdcall SendMobileMessage(long nUserId,
long nDestUserId,[in,string,max_is(100)]char *strContent);
[
entry("QueryMessageA")
]
BOOL __stdcall QueryMessage(long dwSeed,
[in,out,ref]struct TClientPacket *pPacket,
[in,out,string,max_is(nTitleLength)]char *strTitle,
long nTitleLength);
[
entry("QueryNotifyA")
]
BOOL __stdcall QueryNotify(long dwSeed,
[in,out,ref]struct TClientPacket *pPacket,
[in,out,string,max_is(nTitleLength)]char *strTitle,
long nTitleLength,
[in,out,string,max_is(nContentLength)]char *strContent,
long nContentLength);
[
entry("GetGroupInfo")
]
BOOL __stdcall GetGroupInfo(long dwSeed,
[in,out,ref]struct TClientPacket *pPacket,
[in,out,string,max_is(nGroupNameLength)]char *strGroupName,
long nGroupNameLength);
[
entry("GetFriendInfo")
]
BOOL __stdcall GetFriendInfo(long dwSeed,
[in,out,ref]struct TClientPacket *pPacket,
[in,out,string,max_is(nNickNameLength)]char *strNickName,
long nNickNameLength,
[in,out,string,max_is(nEmailLength)]char *strEmail,
long nEmailLength);
[
entry("GetCurGroupsCount")
]
int __stdcall GetCurGroupsCount(long dwSeed);
[
entry("GetCurFriendsCount")
]
bool __stdcall GetCurFriendsCount(long dwSeed,
[in,out,ref]long *pnGroupId,
[in,out,ref]long *pnFriendsCount);
//消息常量
typedef [public] enum MsgType{
SendToPc,
SendToMobile,
ServerNotify,
UpdateGroups,
UpdateFriends,
CurGroupCount,
CurFriendsCount
}MsgType;
typedef [public] struct TClientPacket{
enum MsgType Type;
int dwSenderId;
int dwTitleLength;
int dwContentLength;
byte strDestMobileNumber[20];
}TClientPacket;
}
}
——————————————————————————————————
上面就是这个DLL的IDL文件,这个DLL是用VC写的,而且是标准的WIN32 DLL,本身没有使用COM,为了在VB中调用方便,特别做了这么一个IDL,很多文章都讲过用这样的方法来方便VB中访问WIN32 API函数,可是当我的VB测试程序访问其中公开出来的方法的时候却出现了异常,一共有两个,分别是:
运行是错误'-2147352560(80020010)':
Automation 错误
还有一个是
运行时错误'91':
未设置对象变量或With block 变量
我使用的时候直接从VB中选择引用该IDL产生的类型库,然后直接使用上面定义的方法了,哪位达人知道这是怎么回事啊?