如何在运行期间检查运行时是否支持函数GetSystemTimePreciseAsFileTime
?
答案 0 :(得分:4)
使用着名的GetProcAddress
来查找函数的存在,就像这样
typedef void (WINAPI *FuncT) (LPFILETIME lpSystemTimeAsFileTime);
HINSTANCE hDLL = LoadLibrary(L"Kernel32.dll");
FuncT GetSystemTimePreciseAsFileTime = (Func) GetProcAddress((HMODULE)hDLL, L"GetSystemTimePreciseAsFileTime");
if (GetSystemTimePreciseAsFileTime)
{
// function is exposed by the DLL, now it can be called
GetSystemTimePreciseAsFileTime(...);
}