In VC++ CPP文件: #define DLLEXPORT __declspec(dllexport) __stdcall #define CNAME extern "C" typedef int (__stdcall *CBFUNC)(int); CNAME int DLLEXPORT F(CBFUNC p) { return (*p)(10); } DEF文件: LIBRARY DllTest EXPORTS F In VB Form窗体: Option Explicit Private Sub Command1_Click() CallTest End Sub 模块文件: Option Explicit Private Declare Function F _ Lib "c:\DllTest.dll" ( _ ByVal rt As Long _ ) As Long Private Function CallBackTest(ByVal q As Long) As Long CallBackTest = q * 10 End Function Public Sub CallTest() MsgBox F(AddressOf CallBackTest) End Sub
VB回调设置
最新推荐文章于 2017-03-16 10:13:34 发布