home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples4 / ch13 / fileinfo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  7.3 KB  |  239 lines

  1. VERSION 4.00
  2. Begin VB.Form frmOpen 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Choose a file to view"
  5.    ClientHeight    =   3300
  6.    ClientLeft      =   1545
  7.    ClientTop       =   2880
  8.    ClientWidth     =   6900
  9.    Height          =   3705
  10.    Left            =   1485
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3300
  15.    ScaleWidth      =   6900
  16.    ShowInTaskbar   =   0   'False
  17.    Top             =   2535
  18.    Width           =   7020
  19.    Begin VB.TextBox txtPattern 
  20.       Height          =   315
  21.       Left            =   60
  22.       TabIndex        =   10
  23.       Text            =   "*.*"
  24.       Top             =   2820
  25.       Visible         =   0   'False
  26.       Width           =   2475
  27.    End
  28.    Begin VB.CommandButton cmdExit 
  29.       Caption         =   "E&xit"
  30.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  31.          Name            =   "MS Sans Serif"
  32.          Size            =   8.25
  33.          Charset         =   0
  34.          Weight          =   700
  35.          Underline       =   0   'False
  36.          Italic          =   0   'False
  37.          Strikethrough   =   0   'False
  38.       EndProperty
  39.       Height          =   375
  40.       Left            =   5460
  41.       TabIndex        =   6
  42.       Top             =   600
  43.       Width           =   1275
  44.    End
  45.    Begin VB.CommandButton cmdView 
  46.       Caption         =   "&View"
  47.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  48.          Name            =   "MS Sans Serif"
  49.          Size            =   8.25
  50.          Charset         =   0
  51.          Weight          =   700
  52.          Underline       =   0   'False
  53.          Italic          =   0   'False
  54.          Strikethrough   =   0   'False
  55.       EndProperty
  56.       Height          =   375
  57.       Left            =   5460
  58.       TabIndex        =   5
  59.       Top             =   180
  60.       Width           =   1275
  61.    End
  62.    Begin VB.TextBox txtFileName 
  63.       Height          =   285
  64.       Left            =   120
  65.       TabIndex        =   3
  66.       Top             =   240
  67.       Visible         =   0   'False
  68.       Width           =   2415
  69.    End
  70.    Begin VB.DriveListBox Drive1 
  71.       Height          =   315
  72.       Left            =   2820
  73.       TabIndex        =   2
  74.       Top             =   2820
  75.       Width           =   2475
  76.    End
  77.    Begin VB.FileListBox File1 
  78.       BackColor       =   &H00FFFFFF&
  79.       ForeColor       =   &H00000000&
  80.       Height          =   1785
  81.       Left            =   120
  82.       TabIndex        =   1
  83.       Top             =   600
  84.       Width           =   2415
  85.    End
  86.    Begin VB.DirListBox Dir1 
  87.       Height          =   1830
  88.       Left            =   2820
  89.       TabIndex        =   0
  90.       Top             =   540
  91.       Width           =   2475
  92.    End
  93.    Begin VB.Label Label3 
  94.       Caption         =   "View Files of Type:"
  95.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   8.25
  98.          Charset         =   0
  99.          Weight          =   700
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       Height          =   255
  105.       Left            =   60
  106.       TabIndex        =   11
  107.       Top             =   2580
  108.       Visible         =   0   'False
  109.       Width           =   1635
  110.    End
  111.    Begin VB.Label lblPath 
  112.       Caption         =   "E:\vb4\icons\misc"
  113.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  114.          Name            =   "MS Sans Serif"
  115.          Size            =   8.25
  116.          Charset         =   0
  117.          Weight          =   700
  118.          Underline       =   0   'False
  119.          Italic          =   0   'False
  120.          Strikethrough   =   0   'False
  121.       EndProperty
  122.       Height          =   195
  123.       Left            =   2820
  124.       TabIndex        =   9
  125.       Top             =   300
  126.       Width           =   2475
  127.    End
  128.    Begin VB.Label Label2 
  129.       Caption         =   "Directories:"
  130.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  131.          Name            =   "MS Sans Serif"
  132.          Size            =   8.25
  133.          Charset         =   0
  134.          Weight          =   700
  135.          Underline       =   0   'False
  136.          Italic          =   0   'False
  137.          Strikethrough   =   0   'False
  138.       EndProperty
  139.       Height          =   195
  140.       Left            =   2820
  141.       TabIndex        =   8
  142.       Top             =   60
  143.       Width           =   1455
  144.    End
  145.    Begin VB.Label Label1 
  146.       Caption         =   "Drives:"
  147.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  148.          Name            =   "MS Sans Serif"
  149.          Size            =   8.25
  150.          Charset         =   0
  151.          Weight          =   700
  152.          Underline       =   0   'False
  153.          Italic          =   0   'False
  154.          Strikethrough   =   0   'False
  155.       EndProperty
  156.       Height          =   255
  157.       Left            =   2820
  158.       TabIndex        =   7
  159.       Top             =   2580
  160.       Width           =   1635
  161.    End
  162.    Begin VB.Label Label4 
  163.       Caption         =   "File Name:"
  164.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  165.          Name            =   "MS Sans Serif"
  166.          Size            =   8.25
  167.          Charset         =   0
  168.          Weight          =   700
  169.          Underline       =   0   'False
  170.          Italic          =   0   'False
  171.          Strikethrough   =   0   'False
  172.       EndProperty
  173.       Height          =   195
  174.       Left            =   120
  175.       TabIndex        =   4
  176.       Top             =   60
  177.       Visible         =   0   'False
  178.       Width           =   1395
  179.    End
  180. Attribute VB_Name = "frmOpen"
  181. Attribute VB_Creatable = False
  182. Attribute VB_Exposed = False
  183. Option Explicit
  184. ' Copyright 
  185.  1997 by Desaware Inc. All Rights Reserved
  186. Dim oldDrive$
  187. Private Sub cmdExit_Click()
  188.     Unload Me
  189. End Sub
  190. Private Sub cmdView_Click()
  191.     Dim s$
  192.     s$ = Dir1.Path
  193.     If Right$(s$, 1) <> "\" Then
  194.         s$ = s$ & "\"
  195.     End If
  196.     s$ = s$ & File1.List(File1.ListIndex)
  197.     Load frmView
  198.     frmView.Initialize s$
  199.     frmView.Show 1
  200. End Sub
  201. Private Sub Dir1_Change()
  202.     File1.Path = Dir1.Path
  203.     lblPath = Dir1.Path
  204. End Sub
  205. Private Sub Drive1_Change()
  206.     On Error GoTo handler
  207.     Dir1.Path = Drive1.Drive
  208.     oldDrive$ = Drive1.Drive
  209.     Exit Sub
  210. handler:
  211.     Select Case Err
  212.         Case 68:
  213.             MsgBox "Drive " & UCase$(Drive1.Drive) & " is not available."
  214.             Drive1.Drive = oldDrive$
  215.     End Select
  216.     Exit Sub
  217. End Sub
  218. Private Sub File1_DblClick()
  219.     cmdView_Click
  220. End Sub
  221. Private Sub Form_Load()
  222.     oldDrive$ = Drive1.Drive
  223. End Sub
  224. Private Sub txtPattern_KeyPress(KeyAscii As Integer)
  225.     If KeyAscii = 13 Then
  226.         If txtPattern = "" Then
  227.             txtPattern = "*.*"
  228.         Else
  229.             If Right$(txtPattern, 1) = "." Then
  230.                 txtPattern = txtPattern & "*"
  231.             ElseIf InStr(txtPattern, ".") = 0 Then
  232.                 txtPattern = txtPattern & "*.*"
  233.             End If
  234.         End If
  235.         File1.Pattern = txtPattern.Text
  236.         KeyAscii = 0
  237.     End If
  238. End Sub
  239.