我的应用程序是一个WPF应用程序,它已经拥有较旧类型的系统DPI感知代码,该代码适用于除8.1之外的每个版本的Windows。事实证明,微软在Windows 8.1中添加了许多功能,作为实现每个监视器DPI感知的一部分。我需要在我的程序中实现代码以支持这种类型的DPI感知。
我有文档列出了每个监视器的DPI感知功能及其参数。我需要将它们导入C#并从我的窗口类中调用它们。但我不知道哪些DLL包含这些功能!例如,GetProcessDpiAwareness
函数的文档并未指出它所在的DLL。
如何找到DLL中的导出内容?
答案 0 :(得分:3)
权利之外,一种愚蠢的方法:在C:\Windows\System32
GetProcessDpiAwareness
进行二元搜索,然后用Dependency Walker进行出口研究。
这会产生结果:GetProcessDpiAwareness
导出SHCore.dll
。
也可以搜索Windows SDK头文件和库,但在我的情况下,我没有找到GetProcessDpiAwareness
,令我惊讶。
另一个想法,从命令行提示符运行以下命令:
for %f in (%windir%\system32\*.dll) do dumpbin.exe /exports %f >>%temp%\__exports
然后在%temp%\__exports
搜索API。
答案 1 :(得分:1)
I know it's been asked a while back. (Every time I Google it, this question comes up. So let me share my method.)
If anyone wants to search for functions in DLLs, there's this tool that will do it for you. In case of the GetProcessDpiAwareness
on my Windows 10 (64-bit) it is exported from shcore.dll
like someone had already mentioned above. Here's the screenshot:
Although I need to preface it by saying that it would be always prudent to refer to the function's documentation on MSDN instead. Currently you can find it at the bottom of each page:
If you play around with the search that I showed above, you will notice that many of the system functions are exported from multiple DLLs (some of which are undocumented.) So if you just blindly go with whatever you find in a search app, you may run a risk of breaking your program in the future if Microsoft changes one of those undocumented functions. So use it only for your own research or curiosity.
答案 2 :(得分:0)
通常使用相同资源的函数位于同一个dll中。看看像GetDpiForMonitor这样的另一个dpi函数,你会看到它在Shcore.dll中
编辑:以这种方式找到dll之后,您可以使用依赖性walker仔细检查以查看从该dll导出的函数。