如何在运行时检查运行时是否支持GetSystemTimePreciseAsFileTime
函数?
最佳答案
使用著名的 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(...);
}
关于c++ - 如何在运行时检查Win API函数支持?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24241916/