FileSubType Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The FileSubType property allows you to get additional information about a device driver, font file or virtual device file. This property returns 0 for a file of another type (for example, an executable).

Declaration

aqFileVersionInfoObj.FileSubType

Read-Only Property Integer
aqFileVersionInfoObj An expression, variable or parameter that specifies a reference to an aqFileVersionInfo object

Applies To

The property is applied to the following object:

Property Value

If the file is a device driver (that is, if FileType is VFT_DRV), the property returns one of the following constants defined in the Win32API object:

Constant Value Description
VFT2_UNKNOWN 0 Unknown driver type.
VFT2_DRV_PRINTER 1 A printer driver.
VFT2_DRV_KEYBOARD 2 A keyboard driver.
VFT2_DRV_LANGUAGE 3 A language driver.
VFT2_DRV_DISPLAY 4 A display driver.
VFT2_DRV_MOUSE 5 A mouse driver.
VFT2_DRV_NETWORK 6 A network driver.
VFT2_DRV_SYSTEM 7 A system driver.
VFT2_DRV_INSTALLABLE 8 An installable driver.
VFT2_DRV_SOUND 9 A sound driver.
VFT2_DRV_COMM 10 A communications driver.
VFT2_DRV_VERSIONED_PRINTER 12 A versioned printer driver.

If the file contains a font (that is, if FileType is VFT_FONT), the property returns one of the following constants defined in the Win32API object:

Constant Value Description
VFT2_UNKNOWN 0 Unknown font type.
VFT2_FONT_RASTER 1 A raster font.
VFT2_FONT_VECTOR 2 A vector font.
VFT2_FONT_TRUETYPE 3 A TrueType font.

If the file is a virtual device (that is, if FileType is VFT_VXD), the property returns the virtual-device identifier included in the virtual-device control block.

If the file is an application, a dynamic-link library, a static-link library or a file of an unknown type (that is, if FileType is either VFT_APP, VFT_DLL, VFT_STATIC_LIB or VFT_UNKNOWN), the property returns 0.

Example

The code below determines a file's sub-type using the type of the specified file.

JavaScript, JScript

function VersionInfoSample()
{
  var FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe";
  var VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo;

  Log.Message("File sub type: " + GetFileSubTypeStr(VerInfo.FileType, VerInfo.FileSubType));
}

function GetFileSubTypeStr(FileType, FileSubType)
{
  switch (FileType)
  {
    case VFT_VXD : return "a virtual device file with the " + FileSubType + " identifier.";
    default:
       switch (FileSubType)
       {
          case 0 : return "unknown.";
          case VFT2_DRV_PRINTER : return "a printer driver.";
          case VFT2_DRV_KEYBOARD : return "a keyboard driver.";
          case VFT2_DRV_LANGUAGE : return "a language driver.";
          case VFT2_DRV_DISPLAY : return "a display driver.";
          case VFT2_DRV_MOUSE : return "a mouse driver.";
          case VFT2_DRV_NETWORK : return "a network driver.";
          case VFT2_DRV_SYSTEM : return "a system driver.";
          case VFT2_DRV_INSTALLABLE : return "an installable driver.";
          case VFT2_DRV_SOUND : return "a sound driver.";
          case VFT2_DRV_COMM : return "a communications driver.";
          case VFT2_DRV_VERSIONED_PRINTER : return "a versioned printer driver.";
          case VFT2_FONT_RASTER : return "a rester font.";
          case VFT2_FONT_VECTOR : return "a vector font.";
          case VFT2_FONT_TRUETYPE : return "a TrueType font.";
          default: return "unknown.";
       }
  }
}

Python

def VersionInfoSample():
  FileName = Sys.OSInfo.WindowsDirectory + "\\notepad.exe"
  VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo
  Log.Message("File sub type: " + GetFileSubTypeStr(VerInfo.FileType, VerInfo.FileSubType))

def GetFileSubTypeStr(FileType, FileSubType):
  if FileType == VFT_VXD:
    return "a virtual device file with the " + FileSubType + " identifier."
  else:
    if FileSubType == 0:
      return "unknown."
    elif FileSubType == VFT2_DRV_PRINTER:
      return "a printer driver."
    elif FileSubType == VFT2_DRV_KEYBOARD:
      return "a keyboard driver."
    elif FileSubType == VFT2_DRV_LANGUAGE:
      return "a language driver."
    elif FileSubType == VFT2_DRV_DISPLAY:
      return "a display driver."
    elif FileSubType == VFT2_DRV_MOUSE:
      return "a mouse driver."
    elif FileSubType == VFT2_DRV_NETWORK:
      return "a network driver."
    elif FileSubType == VFT2_DRV_SYSTEM:
      return "a system driver."
    elif FileSubType == VFT2_DRV_INSTALLABLE:
      return "an installable driver."
    elif FileSubType == VFT2_DRV_SOUND:
      return "a sound driver."
    elif FileSubType == VFT2_DRV_COMM:
      return "a communications driver."
    elif FileSubType == VFT2_DRV_VERSIONED_PRINTER:
      return "a versioned printer driver."
    elif FileSubType == VFT2_FONT_RASTER:
      return "a raster font."
    elif FileSubType == VFT2_FONT_VECTOR:
      return "a vector font."
    elif FileSubType == VFT2_FONT_TRUETYPE:
      return "a TrueType font."
    else:
      return "unknown."

VBScript

Sub VersionInfoSample
  Dim FileName, VerInfo

  FileName = Sys.OSInfo.WindowsDirectory & "\notepad.exe"
  Set VerInfo = aqFileSystem.GetFileInfo(FileName).VersionInfo

  Log.Message "File sub type: " & GetFileSubTypeStr(VerInfo.FileType, VerInfo.FileSubType)
End Sub

Function GetFileSubTypeStr(FileType, FileSubType)
  Select Case FileType
    Case VFT_VXD GetFileSubTypeStr = "a virtual device file with the " & FileSubType & " identifier."
    Case Else 
         Select Case FileSubType
            Case 0 GetFileSubTypeStr = "unknown."
            Case VFT2_DRV_PRINTER GetFileSubTypeStr = "a printer driver."
            Case VFT2_DRV_KEYBOARD GetFileSubTypeStr = "a keyboard driver."
            Case VFT2_DRV_LANGUAGE GetFileSubTypeStr = "a language driver."
            Case VFT2_DRV_DISPLAY GetFileSubTypeStr = "a display driver."
            Case VFT2_DRV_MOUSE GetFileSubTypeStr = "a mouse driver."
            Case VFT2_DRV_NETWORK GetFileSubTypeStr = "a network driver."
            Case VFT2_DRV_SYSTEM GetFileSubTypeStr = "a system driver."
            Case VFT2_DRV_INSTALLABLE GetFileSubTypeStr = "an installable driver."
            Case VFT2_DRV_SOUND GetFileSubTypeStr = "a sound driver."
            Case VFT2_DRV_COMM GetFileSubTypeStr = "a communications driver."
            Case VFT2_DRV_VERSIONED_PRINTER GetFileSubTypeStr = "a versioned printer driver."
            Case VFT2_FONT_RASTER GetFileSubTypeStr = "a raster font."
            Case VFT2_FONT_VECTOR GetFileSubTypeStr = "a vector driver."
            Case VFT2_FONT_TRUETYPE GetFileSubTypeStr = "a TrueType driver."
            Case Else GetFileSubTypeStr = "unknown."
        End Select
    End Select
End Function

DelphiScript

function GetFileSubTypeStr(FileType, FileSubType);
begin
  case FileType of
    VFT_VXD : Result := 'a virtual device file with the ' + FileSubType + ' identifier.';
  else
    case FileSubType of
      0 : Result := 'unknown';
      VFT2_DRV_PRINTER : Result := 'a printer driver.';
      VFT2_DRV_KEYBOARD : Result := 'a keyboard driver.';
      VFT2_DRV_LANGUAGE : Result := 'a language driver.';
      VFT2_DRV_DISPLAY : Result := 'a display driver.';
      VFT2_DRV_MOUSE : Result := 'a mouse driver.';
      VFT2_DRV_NETWORK : Result := 'a network driver.';
      VFT2_DRV_SYSTEM : Result := 'a system driver.';
      VFT2_DRV_INSTALLABLE : Result := 'an installable driver.';
      VFT2_DRV_SOUND : Result := 'a sound driver.';
      VFT2_DRV_COMM : Result := 'a communications driver.';
      VFT2_DRV_VERSIONED_PRINTER : Result := 'a versioned printer driver.';
      VFT2_FONT_RASTER : Result := 'a rester font.';
      VFT2_FONT_VECTOR : Result := 'a vector font.';
      VFT2_FONT_TRUETYPE : Result := 'a TrueType font.';
    else 
      Result := 'unknown.';
    end;
  end;
end;

procedure VersionInfoSample;
var FileName, VerInfo;
begin
  FileName := Sys.OSInfo.WindowsDirectory + '\notepad.exe';
  VerInfo := aqFileSystem.GetFileInfo(FileName).VersionInfo;

  Log.Message('File sub type: ' + GetFileSubTypeStr(VerInfo.FileType, VerInfo.FileSubType));
end;

C++Script, C#Script

function VersionInfoSample()
{
  var FileName = Sys["OSInfo"]["WindowsDirectory"] + "\\notepad.exe";
  var VerInfo = aqFileSystem["GetFileInfo"](FileName)["VersionInfo"];

  Log.Message("File sub type: " + GetFileSubTypeStr( VerInfo["FileType"], VerInfo["FileSubType"] ));
}

function GetFileSubTypeStr(FileType, FileSubType)
{
  switch (FileType)
  {
    case VFT_VXD : return "a virtual device file with the" + FileSubType + "identifier.";
    default:
       switch (FileSubType)
       {
          case 0 : return "unknown.";
          case VFT2_DRV_PRINTER : return "a printer driver.";
          case VFT2_DRV_KEYBOARD : return "a keyboard driver.";
          case VFT2_DRV_LANGUAGE : return "a language driver.";
          case VFT2_DRV_DISPLAY : return "a display driver.";
          case VFT2_DRV_MOUSE : return "a mouse driver.";
          case VFT2_DRV_NETWORK : return "a network driver.";
          case VFT2_DRV_SYSTEM : return "a system driver.";
          case VFT2_DRV_INSTALLABLE : return "an installable driver.";
          case VFT2_DRV_SOUND : return "a sound driver.";
          case VFT2_DRV_COMM : return "a communications driver.";
          case VFT2_DRV_VERSIONED_PRINTER : return "a versioned printer driver.";
          case VFT2_FONT_RASTER : return "a rester font.";
          case VFT2_FONT_VECTOR : return "a vector font.";
          case VFT2_FONT_TRUETYPE : return "a TrueType font.";
          default: return "unknown.";
       }
  }
}

See Also

FileType Property
OSFile Property

Highlight search results