Determining the current video mode

The example in this section uses Windows API calls to determine a system's current video mode. If your application needs to display a certain amount of information on one screen, knowing the display size helps you scale the text accordingly.

'32-bit API declaration

Declare Function GetSystemMetrics Lib "user32" _ (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0 Public Const SM_CYSCREEN = 1

Sub DisplayVideoInfo()

vidWidth = GetSystemMetrics(SM_CXSCREEN) vidHeight = GetSystemMetrics(SM_CYSCREEN)

Msg = "The current video mode is: " Msg = Msg & vidWidth & " X " & vidHeight MsgBox Msg End Sub

Figure 11-15 shows the message box returned by this procedure when running on a system set to 1600 x 1024 resolution.

Figure 11-15: Using a Windows API call to determine the video display mode.

Figure 11-15: Using a Windows API call to determine the video display mode.

0 0

Post a comment