P u b l i c   F u n c t i o n   G e t F i l e T y p e ( x F i l e   A s   S t r i n g )   A s   S t r i n g 
 O n   E r r o r   R e s u m e   N e x t 
 D i m   I D   A s   S t r i n g   *   3 0 0 
 I f   D i r $ ( x F i l e )   =   " "   T h e n 
     G e t F i l e T y p e   =   " N O T   F O U N D " 
     E x i t   F u n c t i o n 
 E n d   I f 
 O p e n   x F i l e   F o r   B i n a r y   A c c e s s   R e a d   A s   # 1 
   G e t   # 1 ,   1 ,   I D 
 C l o s e   # 1 
 I f   L e f t ( I D ,   2 )   =   " M Z "   O r   L e f t ( I D ,   2 )   =   " Z M "   T h e n 
     G e t F i l e T y p e   =   " P E   E x e c u t a b l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   1 )   =   " [ "   A n d   I n S t r ( 1 ,   L e f t ( I D ,   1 0 0 ) ,   " ] " )   >   0   T h e n 
     G e t F i l e T y p e   =   " I N I   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   M i d ( I D ,   9 ,   8 )   =   " A V I   L I S T "   T h e n 
     G e t F i l e T y p e   =   " A V I   M o v i e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   4 )   =   " R I F F "   T h e n 
     G e t F i l e T y p e   =   " W A V   A u d i o   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   4 )   =   C h r ( 2 0 8 )   &   C h r ( 2 0 7 )   &   C h r ( 1 7 )   &   C h r ( 2 2 4 )   T h e n 
     G e t F i l e T y p e   =   " M i c r o s o f t   W o r d   D o c u m e n t " 
     E x i t   F u n c t i o n 
 E l s e I f   M i d ( I D ,   5 ,   1 5 )   =   " S t a n d a r d   J e t   D B "   T h e n 
     G e t F i l e T y p e   =   " M i c r o s o f t   A c c e s s   D a t a b a s e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   3 )   =   " G I F "   O r   I n S t r ( 1 ,   I D ,   " G I F 8 9 " )   >   0   T h e n 
     G e t F i l e T y p e   =   " G I F   I m a g e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   1 )   =   C h r ( 2 5 5 )   A n d   M i d ( I D ,   5 ,   1 )   =   C h r ( 0 )   T h e n 
     G e t F i l e T y p e   =   " M P 3   A u d i o   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   2 )   =   " B M "   T h e n 
     G e t F i l e T y p e   =   " B M P   ( B i t m a p )   I m a g e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   3 )   =   " I I * "   T h e n 
     G e t F i l e T y p e   =   " T I F F   I m a g e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   2 )   =   " P K "   T h e n 
     G e t F i l e T y p e   =   " Z I P   A r c h i v e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   I n S t r ( 1 ,   L C a s e ( I D ) ,   " < h t m l > " )   >   0   O r   I n S t r ( 1 ,   L C a s e ( I D ) ,   " < ! d o c t y p e " )   >   0   T h e n 
     G e t F i l e T y p e   =   " H T M L   D o c u m e n t   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   U C a s e ( L e f t ( I D ,   3 ) )   =   " R A R "   T h e n 
     G e t F i l e T y p e   =   " R A R   A r c h i v e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   2 )   =   C h r ( 9 6 )   &   C h r ( 2 3 4 )   T h e n 
     G e t F i l e T y p e   =   " A R J   A r c h i v e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   3 )   =   C h r ( 2 5 5 )   &   C h r ( 2 1 6 )   &   C h r ( 2 5 5 )   T h e n 
     G e t F i l e T y p e   =   " J P E G   I m a g e   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   I n S t r ( 1 ,   I D ,   " T y p e = " )   >   0   A n d   I n S t r ( 1 ,   I D ,   " R e f e r e n c e = " )   >   0   T h e n 
     G e t F i l e T y p e   =   " V i s u a l   B a s i c   P r o j e c t   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   8 )   =   " V B G R O U P   "   T h e n 
     G e t F i l e T y p e   =   " V i s u a l   B a s i c   G r o u p   P r o j e c t   F i l e " 
     E x i t   F u n c t i o n 
 E l s e I f   L e f t ( I D ,   8 )   =   " V E R S I O N   "   &   I n S t r ( 1 ,   I D ,   v b C r L f   &   " B e g i n " )   >   0   T h e n 
     G e t F i l e T y p e   =   " V i s u a l   B a s i c   F o r m   F i l e " 
     E x i t   F u n c t i o n 
 E l s e 
   ' U n k n o w n   f i l e . . .   m a k e   a   w e a k   a t t e m p t   t o   d e t e r m i n e   i f   t h e   f i l e   i s   t e x t   o r   b i n a r y 
   I f   I n S t r ( 1 ,   I D ,   C h r $ ( 2 5 5 ) )   >   0   O r   I n S t r ( 1 ,   I D ,   C h r $ ( 1 ) )   >   0   O r   I n S t r ( 1 ,   I D ,   C h r $ ( 2 ) )   >   0   O r   I n S t r ( 1 ,   I D ,   C h r $ ( 3 ) )   >   0   T h e n 
     G e t F i l e T y p e   =   " U n k n o w n   b i n a r y   f i l e " 
   E l s e 
     G e t F i l e T y p e   =   " U n k n o w n   t e x t   f i l e " 
   E n d   I f 
   E x i t   F u n c t i o n 
 E n d   I f 
 E n d   F u n c t i o n 
 