How to determine whether an executable is for Windows or DOS
To find if an executable is for DOS or for Windows, you check byte offset 24 in the file. If it contains 40h, it's a Windows executable. Note: Byte offset 24 equals byte 25, since offsets count from 0.

Function WinExe (ByVal Exe As String) As Integer

Dim fh As Integer
Dim t  As String * 1

   fh = FreeFile
   Open Exe For Binary As #fh
      Get fh, 25, t
   Close #fh

   WinExe = (Asc(t) = &H40&)

End Function