1.DLL原代码:
#include "stdafx.h"BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
 )
{
    return TRUE;
}int _declspec(dllexport) GetValue(int n)
{
if(n == 1)
{
return 10;
}
else
return 200;
}2.调用DLL
void CTestDlg::OnButton1() 
{
// TODO: Add your control notification handler code here
typedef int (*ABC)(int);
HINSTANCE h;
h = LoadLibrary("TDll.dll");
ABC abc;
abc = (ABC)GetProcAddress(h,"GetValue"); abc(4);
FreeLibrary(h);
}我只是写了一个测试程序,所以没有进行其他判断和处理,不知是哪儿出了问题.