Example Code

GetSystemMetrics - DLL Call To Get System Metrics

Code and Documents

Attachment

Download All

Overview
This example demonstrates the use of GetSystemMatrics function from user32.dll in Windows to get system metrics.

 

Description

This is an example of how to use the GetSystemMatrics function from user32.dll in Windows. In addition to the basic functionality, I've created a ring control with all the possible values preloaded. The user selects the metric they want to query with this ring control, which will indicate the index value it is matched to, and also show a description on the right hand side. I've manually re-created a search function for the description as the index values skip certain indexes, meaning I couldn't use an enum or sequential values.

It's not possible to use this as a sub VI directly as I've used an event-driven approach to add the extra functionality in, but you can easily take that part away and use the DLL call inside a sub VI.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Open the VI " Get System Metrics 2012 NIVerified.vi"
  2. Select a statement from GetsystemMetrics.
  3. Run the VI.

 

Additional Information or References
VI Block Diagram

Block Diagram.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Regards,


Imtiaz Chowdhury
Project Manager
Green Running / Austin Consultants

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.