tags:

views:

26

answers:

3

Hi,(newbie in .net)

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.

+1  A: 

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

njak32
+1  A: 

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()
Jared Harley
+1  A: 

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.

Hans Passant