我有一个C#表单应用程序...我创建了一个dll ...现在我想用该程序启动该dll。我该怎么做?使用C#程序启动dll
#include <windows.h>
typedef int (*function1_ptr)();
function1_ptr function1=NULL;
int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) {
HMODULE myDll = LoadLibrary("Dll1.dll");
if(myDll!=NULL) {
function1 = (function1_ptr) GetProcAddress(myDll,"function1");
if(function1!=NULL)
function1();
else
exit(4);
FreeLibrary(myDll);
}
else
exit(6);
GetLastError();
return 0;
}
这是用代码来测试我的DLL ...即Dll1.dll .. function1
是dll1.dll内的功能.....我可以做的C#代码类似的东西???
你叫什么“启动”一个DLL?一个DLL是类的容器。在dll中没有入口点。 – 2011-02-02 16:43:08
使用此程序调用DLL ....为了查看DLL是否工作...我曾尝试调用DLL的代码...这帮助我找出DLL工作 – 2011-02-02 16:48:41