vb程序exe配vc程序dll如何实现我要的功能?

a294447011294447011 2009-05-27 09:37:34
vb程序:
普通模块:
Public Declare Function Load Lib "mydll.dll"(ByVal VbFunRva As Long) As Boolean

Public Sub fun(ByVal str1 As String)
Form1.Text1.Text = str1' 我的目的是让Form1.Text1.Text 得到dll里的:"vc_dll";可程序启动就错误了?请帮忙解决这个问题?
End Sub

窗口代码:
Private Sub Form_Load()
Load AddressOf fun
End Sub

///////////////////////////////////////////////////////////////
vc程序(mydll.dll):

typedef void (WINAPI *FUN)(char *str1);
char *strstr1="vc_dll";
extern "C" bool _declspec(dllexport)__stdcall Load(int VbFunRva)//vb一个回调函数地址
{
FUN fun=(FUN)VbFunRva;
fun(strstr1);
return 1;
}
...全文
49 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
g:\资源目录\桌面\c++\vc98\include\oleauto.h(30) : error C2143: syntax error : missing ';' before 'const'
g:\资源目录\桌面\c++\vc98\include\oleauto.h(30) : error C2501: 'EXTERN_C' : missing storage-class or type specifiers
g:\资源目录\桌面\c++\vc98\include\oleauto.h(30) : error C2146: syntax error : missing ';' before identifier 'IID_StdOle'
g:\资源目录\桌面\c++\vc98\include\oleauto.h(30) : error C2734: 'IID' : const object must be initialized if not extern
g:\资源目录\桌面\c++\vc98\include\oleauto.h(30) : fatal error C1004: unexpected end of file found


超级绿豆——嘿咻嘿咻,这些怎么解决?
supergreenbean 2009-05-27
  • 打赏
  • 举报
回复
#include <Oleauto.h>
#include <comdef.h>
#include <comutil.h>

typedef void (WINAPI *FUN)(BSTR str1);
char *strstr1="vc_dll";
extern "C" BOOL _declspec(dllexport)__stdcall Load(int VbFunRva)//vb一个回调函数地址
{
FUN fun=(FUN)VbFunRva;
fun(SysAllocString(_bstr_t(strstr1)));
return 1;
}

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧