1、需要包含头文件:
#include <atlstr.h>
2、将宽字符集(Unicode)转化为多字符集(ASCII),使用CW2A
3、将多字符集(ASCII)转化为宽字符集(Unicode),使用CA2W
CA2W("Test_DLL_Demo001.dll")
备注, 顺便给出,动态加载dll的方式:
HINSTANCE hDll_Test_DLL_Demo001 = ::LoadLibrary(CA2W("Test_DLL_Demo001.dll"));typedef int (*pAdd) (int n1, int n2);pAdd Add = (pAdd) GetProcAddress(hDll_Test_DLL_Demo001, "Add");if (hDll_Test_DLL_Demo001){cout << Add(9, 5) << endl;FreeLibrary(hDll_Test_DLL_Demo001);}else{cout << "dll Load Failure !" << endl;}
---- The End.