AppType (function)


AppType [(name$)]


Returns an Integer indicating the executable file type of the named application:



DOS executable



Windows executable


The name$ parameter is a String containing the name of the application. If this parameter is omitted, then the active application is used.


This example creates an array of strings containing the names of all the running Windows applications. It uses the AppType command to determine whether an application is a Windows application or a DOS application.

Sub Main()

  Dim apps$(),wapps$()

  AppList apps     'Retrieve a list of all Windows and DOS apps.
  If ArrayDims(apps) = 0 Then
    MsgBox "There are no running applications."
    Exit Sub
  End If

  'Create an array to hold only the Windows apps.
  ReDim wapps$(UBound(apps))
  n = 0 'Copy the Windows apps from one array to the target array.
  For i = LBound(apps) to UBound(apps)
    If AppType(apps(i)) = ebWindows Then
      wapps(n) = apps(i)
      n = n + 1
    End If
  Next I

  If n = 0 Then    'Make sure at least one Windows app was found.
    MsgBox "There are no running Windows applications."
    Exit Sub
  End If

  ReDim Preserve wapps(n - 1)   'Resize to hold the exact number.
  'Let the user pick one.
  index% = SelectBox("Windows Applications","Select a Windows application:",wapps)
End Sub


The name$ parameter is the exact string appearing in the title bar of the named application's main window. If no application is found whose title exactly matches name$, then a second search is performed for applications whose title string begins with name$. If more than one application is found that matches name$, then the first application encountered is used.




More information