Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.6 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmFolderChooser
  3. BorderStyle = 1 'Fixed Single
  4. Caption = "Choose folder"
  5. ClientHeight = 3495
  6. ClientLeft = 45
  7. ClientTop = 330
  8. ClientWidth = 4680
  9. LinkTopic = "Form1"
  10. MaxButton = 0 'False
  11. MinButton = 0 'False
  12. ScaleHeight = 3495
  13. ScaleWidth = 4680
  14. StartUpPosition = 3 'Windows Default
  15. Begin VB.CommandButton cmdCancel
  16. Caption = "Cancel"
  17. Height = 375
  18. Left = 3720
  19. TabIndex = 3
  20. Top = 3000
  21. Width = 855
  22. End
  23. Begin VB.CommandButton cmdOK
  24. Caption = "OK"
  25. Height = 375
  26. Left = 2760
  27. TabIndex = 2
  28. Top = 3000
  29. Width = 855
  30. End
  31. Begin VB.DirListBox Dir1
  32. Height = 2340
  33. Left = 120
  34. TabIndex = 1
  35. Top = 480
  36. Width = 4455
  37. End
  38. Begin VB.DriveListBox Drive1
  39. Height = 315
  40. Left = 120
  41. TabIndex = 0
  42. Top = 120
  43. Width = 4455
  44. End
  45. End
  46. Attribute VB_Name = "frmFolderChooser"
  47. Attribute VB_GlobalNameSpace = False
  48. Attribute VB_Creatable = False
  49. Attribute VB_PredeclaredId = True
  50. Attribute VB_Exposed = False
  51. Option Explicit
  52. Private p_FSO As Scripting.FileSystemObject
  53. Private p_intIndex As Long
  54. Public Event FolderChosen(ByVal intIndex As Long, ByVal strFolder As String)
  55. Private Sub Form_Load()
  56. cmdOK.Default = True
  57. cmdCancel.Cancel = True
  58. Set p_FSO = New Scripting.FileSystemObject
  59. End Sub
  60. Private Sub Form_Unload(Cancel As Integer)
  61. Set p_FSO = Nothing
  62. End Sub
  63. Private Sub cmdOK_Click()
  64. RaiseEvent FolderChosen(p_intIndex, Dir1.Path)
  65. Unload Me
  66. End Sub
  67. Private Sub cmdCancel_Click()
  68. Unload Me
  69. End Sub
  70. Private Sub Drive1_Change()
  71. Dir1.Path = Mid$(Drive1.Drive, 1, 2) & "\"
  72. End Sub
  73. Public Sub SetFolder( _
  74. ByVal i_intIndex As Long, _
  75. ByVal i_strFolder As String _
  76. )
  77. Dim strDrive As String
  78. Dim strFolder As String
  79. If (p_FSO.FolderExists(i_strFolder)) Then
  80. strFolder = i_strFolder
  81. Else
  82. strFolder = p_FSO.GetSpecialFolder(TemporaryFolder)
  83. End If
  84. Drive1.Drive = p_FSO.GetDriveName(strFolder)
  85. Dir1.Path = strFolder
  86. p_intIndex = i_intIndex
  87. End Sub