home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / f_open / fopen.frm (.txt) < prev    next >
Visual Basic Form  |  1991-06-25  |  11KB  |  191 lines

  1.     FOpenForm
  2.     File Open
  3. wwwwwwwwwp
  4. wwwwwwwwwp
  5. wwwwwwwwwp
  6. Form1*
  7. Text1
  8. FileName
  9. Command1
  10. &Open
  11. FNameLabel
  12. File &Name:
  13. Label4
  14. Directory:
  15. Label1
  16. Label1
  17. Command2
  18. &Cancel
  19. FilesLabel
  20. &Files:
  21. DirLabel
  22. &Directories:
  23. File1
  24. List1
  25. TheFocus
  26.     List1Flag@
  27.     Text1Flag
  28. TheDriveI
  29. LastChange
  30.     Form_Load
  31.     FormTitle>
  32.     FOpenForm
  33. caption7
  34. ThePath
  35. File1
  36. ThePattern
  37. Pattern
  38. Text1b
  39. Textr
  40. Label1
  41. Form_GotFocus|
  42. List1 
  43. List1_GotFocus
  44. GetFocus
  45. SendMessageY
  46. LB_DIR
  47.     BuildSpec
  48. selstart
  49.     sellength
  50. visible
  51. List1_Dblclick
  52.     Listindex
  53. curnt
  54. OldPath
  55. ChangeDrive
  56. ErrState
  57. LB_RESETCONTENT
  58. List1_KeyPress}
  59. KeyAsciik
  60. File1_Click
  61. FileName
  62. File1_KeyPress
  63. File1_DblClick
  64. Command1_Click
  65. Text1_Keypress
  66. RemoveSpaces
  67.     Listcount<
  68. TheFileNameV
  69. Foundit
  70. true7
  71. false
  72. tempo
  73. ProcessEntry
  74.     ChangeDir
  75.     TheStructv
  76. OfStruct
  77. OpenFile
  78. OF_EXIST
  79. lclose
  80. FullName
  81. Text1_Change
  82. List1_Click
  83. TheText
  84. Command2_Click
  85. fpath
  86. Text1_GotFocus
  87.     TextLimit
  88. EM_LIMITTEXT
  89. CompleteName
  90. ErrCodeK
  91. DirLabel_Click
  92. Label4_Click
  93. You are welcome to use FOPEN in your programs free of charge."
  94. If you make any improvements send me a copy at CIS-MAL 73667,1755e
  95. Costas Kitsosn
  96.  Handle for Drive/Subdirectory ListBox
  97.  Flag for Drive/Subdirectory ListBox 0 or 1M
  98.  Flag for EM_LIMITTEXT
  99.  The selected driveE
  100.  Flag used when processing selectionsM
  101. Form_Load
  102.  Set the flags for List1 and Text1 e
  103.  Update Drive/Subdirectory listbox
  104.  Limit text length r
  105.  If the Parent didn't specify a FormTitle use the one that's built in.
  106. File Open"
  107.  otherwise honor the Parent's specifications
  108.  If there is a path specification use it, otherwise use the default.
  109.  If the Parent specified a new pattern then use it. 
  110.  Finish up loading the form.
  111. Form_GotFocus
  112.  Set the Focus on List1 to fill the ListBoxh
  113. List1_GotFocus
  114.  get the handle of the ListBox
  115.  fill it with the Drive/Subdirectory listing
  116.  update the flag so we don't go through this every timeo
  117.  highlight Text1
  118. List1_Dblclick
  119.  List1 holds both drives and subdirectoriess
  120. get the current selectione
  121. save the old path in case of error
  122.  if the user chose a drive parse it and change to it
  123.  if the user chose a subdirectory change to it
  124.  LB_RESETCONTENT clears the list fastn
  125.  LB_DIR specifies the type of listbox, &HC010 specifies drives and subdirectories only.l
  126.  if there was an error let the user know.C
  127. List1_KeyPress
  128.  if the user presses the Return key while on a valid entry, invoke a List1_DblClickn
  129. File1_Click
  130.  update the textbox and the lastchange flagn
  131. File1_KeyPress
  132.  if Return, select File1_DblClickh
  133. File1_DblClick
  134.  Good, we have a file, let's tell Command1
  135. Text1_Keypress
  136.  process whatever the user typed in Text11
  137.  get rid of the beep (Mark, thanks for the tip)t
  138.  remove any space characters.  Some users put a space after a period out of habit.
  139.  see if the file is in File1.List. If it is, we're done so let's tell Command1.i
  140.  if the file is not in File1.List let's see what the user is trying to do.
  141. drive?
  142. subdirectory? 
  143. wildcards?
  144. flag used by ChangeDrive
  145. if we found a drive change to it
  146.  If changing to the drive didn't cause any errors or if a drive wasn't specified
  147.  if a subdirectory was specified
  148.  newd$ holds everything to the left of the last backslash 
  149.  tempo$ hold the rest.  Now, process them.
  150.  did the user specify only a new pattern?.
  151.  highlight the text
  152. ChangeDrive
  153.  try to change to the new drivew
  154.  if an error occurred go back to the way things were
  155. change the flag so Text1 knows
  156. ChangeDir
  157.  change to the new directory and update List1g
  158.  you may add a MsgBox error message here if you think it's
  159.  necessary.y
  160. ProcessEntry
  161.  we'll use this if/when we have to use OpenFile
  162.  if a$(newd$) isn't empty change to it.O
  163. if b$(tempo$) isn't empty let's see what it could be.
  164. if it's a new pattern then let File1.List know
  165. otherwise could it be a file?
  166. use OpenFile to see if it exists.  If so x% will return a file handle.
  167. This is a very useful API function.I
  168. close the file
  169. if we have a file handle, we're done let's tell Command1
  170. no handle? The user probably specified a subdirectory.
  171. Text1_Change
  172. needed by Command1
  173. Command1_Click
  174. process Text1 entryT
  175. we have a file, put together the FullNamei
  176. let List1 know
  177. we have a file and a FullName
  178. we have a file, put together the FullName
  179. List1_Click
  180.  let Command1 know
  181. RemoveSpaces
  182.  squeezes out spaces
  183. Command2_Click
  184.  ' did the user press cancel?  Change FullName into an empty string
  185.  so the Parent knows.n
  186. BuildSpec
  187.  builds the spec for SendMessage
  188. Text1_GotFocus
  189.  Do this only once
  190.  send the message to limit the text entry to not more than 127 characterse
  191.