Example Code

Obtain Full Size of LabWindows/CVI Panel Window

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Other

Code and Documents

Attachment

Overview
demonstrates how to calculate the full size of a panel window, which includes the panel size, the title, and the border frame sizes.


Description
This example demonstrates how you determine the full size of a panel in LabWindows/CVI. The panel attributes Height and Width, that you can get or set with the functions GetPanelAttribute or SetPanelAttribute respectively, refer to the panel itself without taking into account the title or the borders.

Some window attributes (e.g. title bar size, border frame size) belong to every window on your computer and not only to your particular CVI panel. These attributes, that influence the final window size, depend on your Operating System settings. Therefore, in order to get the correct size of the entire window that will be displayed, you can use the Windows SDK function, GetSystemMetrics.

 

Requirements

  1. LabWindows/CVI 2013SP2


Steps to Implement or Execute Code

  1. Unzip the FullPanelSize.zip folder
  2. Run FullPanelSize.exe
  3. Click GetFullPanelSize to see the height and width of the entire panel window printed to the console.
  4. Change the size of the panel and click GetFullPanelSize again to see the values changed appropriately.
  5. You can also monitor the variables in the source code (FullPanelSize.c) to see how the full panel size compares to the PanelHeight and PanelWidth returned by GetPanelAttribute.
  6. Select QUIT or click the X in the window to close the application.

 

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

Kelsey W.
National Instruments
Applications Engineer

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