vb调用vc编写的dll遇到的问题
vb调用vc编写的dll遇到的错误
各位大虾,小弟在用vb调用vc编写的dll是遇到了错误,渴求帮帮忙:
vc中代码:
dll3.h:
#ifdef DLL3_EXPORTS
#define DLL3_API __declspec(dllexport)
#else
#define DLL3_API __declspec(dllimport)
#endif
// This class is exported from the dll3.dll
class DLL3_API CDll3 {
public:
CDll3(void);
// TODO: add your methods here.
};
extern DLL3_API int nDll3;
DLL3_API short fnDll3();/////////////////////////我主要用它
extern DLL3_API short __stdcall sample();
dll3.cpp代码:
#include "stdafx.h"
#include "dll3.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported variable
DLL3_API int nDll3=0;
// This is an example of an exported function.
DLL3_API short fnDll3()
{
return 42;
}
// This is the constructor of a class that has been exported.
// see dll3.h for the class definition
CDll3::CDll3()
{
return;
}
DLL3_API short __stdcall sample()
{
return 10;
}
生成的dll3.dll 放入system32目录下;
vb中的代码:
Option Explicit
Private Declare Function fnDll3 Lib "dll3.dll" () As Integer
Private Sub Command1_Click()
Dim i As Integer
i = 12
i = fnDll3 //////////////
MsgBox i
End Sub
错误提示: can't find Dll entry point fnDll3 in dll3.dll
都愁死我了,恳求大虾们帮帮忙,
期待中......
万分感谢~
各位大虾,小弟在用vb调用vc编写的dll是遇到了错误,渴求帮帮忙:
vc中代码:
dll3.h:
#ifdef DLL3_EXPORTS
#define DLL3_API __declspec(dllexport)
#else
#define DLL3_API __declspec(dllimport)
#endif
// This class is exported from the dll3.dll
class DLL3_API CDll3 {
public:
CDll3(void);
// TODO: add your methods here.
};
extern DLL3_API int nDll3;
DLL3_API short fnDll3();/////////////////////////我主要用它
extern DLL3_API short __stdcall sample();
dll3.cpp代码:
#include "stdafx.h"
#include "dll3.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported variable
DLL3_API int nDll3=0;
// This is an example of an exported function.
DLL3_API short fnDll3()
{
return 42;
}
// This is the constructor of a class that has been exported.
// see dll3.h for the class definition
CDll3::CDll3()
{
return;
}
DLL3_API short __stdcall sample()
{
return 10;
}
生成的dll3.dll 放入system32目录下;
vb中的代码:
Option Explicit
Private Declare Function fnDll3 Lib "dll3.dll" () As Integer
Private Sub Command1_Click()
Dim i As Integer
i = 12
i = fnDll3 //////////////
MsgBox i
End Sub
错误提示: can't find Dll entry point fnDll3 in dll3.dll
都愁死我了,恳求大虾们帮帮忙,
期待中......
万分感谢~
...全文
相关推荐
分享如何在VB中调用VC编写的DLL
一般来说,VB和VC共同编程有3种方式:一种是VC生成DLL,在VB中调用DLL;一种是VC生成ActiveX控件(.ocx),在VB中插入;还有一种是在VC中生成ActiveX Automation服务器,在VB中调用
Dll.rar_VC调用VB DLL
dll创建,及在vc和vb中调用使用说明
VC写的DLL给VB用,传送字符串
VB和VC写的DLL之间传达室送字符串。调试通过的源代码。网上的代码和文档都是用整型add(a,b)做例子。自己试试就知道传送string还会有那么多问题。耗了我不少时间!希望能节省你的时间!
vb调用vc写的dll截获修改封包源代码
参照防火墙源代码,自己写的vb调用vc写的dll截获和修改封包,用于xp,2000系统。包括vb源代码,vc dll源代码绝对超值。有兴趣讨论封包的同志们可以加我。qq:23131683
VB调用VC生成的动态链接库
VB调用VC生成的动态链接库,附有源代码


VB基础类

