Silverfrost Forums

Welcome to our forums

Informations about windows metrics?

7 Apr 2018 12:41 #21753

Depending on the dimensions of the used PC-monitor, my programs define the size (width and height) and the place (x-position,y-position) of the needed windows. In the manual I find only a routine, which allows to get infomations about the used screen and the used font:

      INCLUDE <windows.ins>
      INTEGER*4 xres,yres,font_h
      xres = clearwin_info@('screen_width')   ! Monitorpixels in x/w-direction
      yres = clearwin_info@('screen_depth')   ! Monitorpixels in y/h-direction
      font_h=clearwin_info@('system_font_height')

To specify the dimensions of windows to be opended at the screen, some more informations about the used parameters are helpfull, such as:

  • width of borderline
  • width of frameline
  • height of caption bar
  • width and heigth of scrollbars (vertical and horizontal)
  • width and heigth of menu bar
  • width and heigth of frame
  • width and heigth of border

Is it possible to get these informations with the same procedure clearwin_info@('.....'); what are the 'keywords'. For Information: I'm using Personal Edition V8.1

7 Apr 2018 4:00 #21759

These parameters can be obtained by calling the Windows API function GetSystemMetrics. The interface is in win32api.ins and details can be found by searching for 'MSDN GetSystemMetrics'.

26 Nov 2018 4:48 #22858

Hi Paul, my question from april is a long time ago already, but still currently. I looked at the Microsoft page 'GetSystemMetrics function' and found an example. But I'm not sure which files must be included and how to express the ftn95-statements . Do you have an example for FTN95 how to call the parameters from the Windows API function GetSystemMetrics?

26 Nov 2018 7:15 #22860
      WINAPP
      PROGRAM System_Metrics
      INCLUDE <WINDOWS.INS>
      iWINDOW_BORDER    = GetSystemMetrics (SM_CXBORDER)
      iWINDOW_MENU_HEIGHT = GetSystemMetrics (SM_CYMENU)
      WRITE (*,*) iWINDOW_BORDER, iWINDOW_MENU_HEIGHT
      END

Implicit typing used. Values and type declarations for the parameters SM_etc are given in one of the include files.

Eddie

27 Nov 2018 12:50 #22863

... and to add to the above (which I did in a hurry), all the 'enquiry' functions work like this. The parameter(s) to the routines are usually just simple integers, but they are all assigned to named variables to make the code more readable. The answer is returned.

If you look at the 'INS' files, you will see what a huge range of functions there are (look in win32api.ins at first). These functions are all described online in MSDN. You should use the parameter names (like SM_CXBORDER) and not the numeric values if you want to be able to read your code afterwards.

Eddie

Please login to reply.