| {\rtf1\ansi\ansicpg1252\deff0\deflang1044{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} \viewkind4\uc1\pard\f0\fs17 The Microsoft SysInfo control provides a great way of gathering system information without resorting to API functions. Included in this handy control are three properties (OSBuild, OSPlatform, and OSVersion) that expose information about the operating system. However, if you've ever used these properties, you may have been confused by the results. You see, all three properties return numbers as their values--and the control doesn't expose any constants to describe which numbers map back to which OS. \par \par Fortunately, we've decoded the cipher. By using a combination of the OSPlatform and OSVersion numbers, you can quickly determine the OS, as seen in the following code: \par \par Dim OS As String \par \par With SysInfo1 \par Select Case .OSPlatform \par Case 0: OS = "Win32" \par Case 1: \par Select Case .OSVersion \par Case 4: OS = "Win 95" \par Case 4.1: OS = "Win 98" \par End Select \par Case 2: \par Select Case .OSVersion \par Case 4: OS = "Win NT" \par Case 5: OS = "Win 2000" \par Case 6: OS = "Win XP" \par End Select \par End Select \par \par MsgBox "Build:" & .OSBuild & vbNewLine & _ \par "Platform:" & OS & "(" & .OSPlatform & ")" & vbNewLine & _ \par "Version:" & .OSVersion \par End With \par } |
Determining the system OS with the SysInfo control |
India web developer web development India | India web development company India ecommerce web developer