//Test1.h
#include
#include
//红色的是为了让代码能同时用于C和C++(
不加的话,用于c正常,C++可能不正常 )
#ifdef
__cplusplus
extern "C"
{
#endif
__declspec(dllexport)void _stdcallTest1();
#ifdef
__cplusplus
}
#endif
//
void _stdcall Test1()
{
MessageBox(
NULL,"用C写的dll测试",0,0 );
}
//
//
Test1.def
LIBRARY
jues
DESCRIPTION "this is jues dll"
EXPORTS
Test1;
//
C/C++(VC)下调用
#include
"jues.h"
#pragma comment(lib,"jues.lib")
void main()
{
jues_Call(
"explorer.exe" );
}
//
/// vb下调用
//
///
//
///
//
///
Option Explicit
Private Declare Sub Test1 Lib "D:\temp\jues\Debug\jues.dll"
() '函数名( 如果有参数的话可以用 ByVala As
String )
'有ByVal 和 ByRef
(取址)
Private Sub Command1_Click()
Test1 '调用
End Sub