加载DLL LoadLibrary,加载字符串LoadString,然后卸载DLL(假设你不需要其他任何东西)FreeLibrary:
HMODULE hDll = LoadLibrary("C:\\WINDOWS\\System32\\wscsvc.dll");
if(hDll != NULL)
{
wchar_t *str;
if(LoadStringW(hDll, +200, (LPWSTR)&str, 0) > 0)
; // success! str now contains a (read-only) pointer to the desired string
else
; // handle error
FreeLibrary(hDll);
}
else
; // handle error
Run Code Online (Sandbox Code Playgroud)
请注意LoadLibrary(几乎任何其他函数都采用文件名)不理解环境变量%SystemRoot%.你必须使用一个函数ExpandEnvironmentStrings来扩展DLL文件名中的环境变量,然后再传递给它LoadLibrary.