how to get all the info. available in the "system configuration" feature of windows
I want all the info. available in the "system configuration " feature of windows in my program.I think there would be an implementation of "GetSystemMetrics" function of the win32 api inside .net somewhere 开发者_高级运维but I can't find it. Also how can I get info. about the system's current DPI settings?
OR,if there's a better way please tell me.
System : Win7(32 bit)/VS2008
Thanks.
If I have interpreted you question correctly then this would be the System.Configuration namespace which I am more than certain will help you with 'the info. available in the "system configuration " feature of windows'. Meanwhile the GetSystemMetrics alternative in .Net is contained in the SystemInformation Class
You should be able to get the current DPI from a System.Drawing.Graphics
object, looking at the DpiX
and DpiY
properties:
System.Drawing.Graphics g;
g = this.CreateGraphics();
this.currentDpiX = g.DpiX;
this.currentDpiY = g.DpiY;
g.Dispose()
Everybody misunderstands your question because Windows doesn't actually have a "system configuration" feature. The Msconfig.exe tool doesn't show anything like the info that GetSystemMetrics returns.
GetSystemMerics is well covered by the SystemParameters class. There's a wealth of info available from WMI queries, supported by the System.Management class. The best way to play with that is the WMI Code Creator tool, it lets you run queries and can automatically generate the C# code for them.
精彩评论