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.

313 lines
11 KiB

  1. VERSION 5.00
  2. Begin VB.PropertyPage ppgDirStats
  3. Caption = "FileViewer"
  4. ClientHeight = 4425
  5. ClientLeft = 0
  6. ClientTop = 0
  7. ClientWidth = 5895
  8. PaletteMode = 0 'Halftone
  9. ScaleHeight = 4425
  10. ScaleWidth = 5895
  11. Begin VB.Label lblField
  12. Height = 255
  13. Index = 0
  14. Left = 60
  15. TabIndex = 11
  16. Top = 240
  17. Width = 2055
  18. End
  19. Begin VB.Label lblValue
  20. Height = 255
  21. Index = 0
  22. Left = 2325
  23. TabIndex = 10
  24. Top = 240
  25. Width = 3375
  26. End
  27. Begin VB.Label lblField
  28. Height = 255
  29. Index = 1
  30. Left = 60
  31. TabIndex = 9
  32. Top = 960
  33. Width = 2055
  34. End
  35. Begin VB.Label lblValue
  36. Height = 255
  37. Index = 1
  38. Left = 2340
  39. TabIndex = 8
  40. Top = 960
  41. Width = 3375
  42. End
  43. Begin VB.Label lblField
  44. Height = 255
  45. Index = 2
  46. Left = 60
  47. TabIndex = 7
  48. Top = 1560
  49. Width = 2055
  50. End
  51. Begin VB.Label lblValue
  52. Height = 255
  53. Index = 2
  54. Left = 2340
  55. TabIndex = 6
  56. Top = 1560
  57. Width = 3375
  58. End
  59. Begin VB.Label lblField
  60. Height = 255
  61. Index = 3
  62. Left = 60
  63. TabIndex = 5
  64. Top = 2280
  65. Width = 2115
  66. End
  67. Begin VB.Label lblValue
  68. Height = 255
  69. Index = 3
  70. Left = 2340
  71. TabIndex = 4
  72. Top = 2280
  73. Width = 3375
  74. End
  75. Begin VB.Label lblField
  76. Height = 255
  77. Index = 4
  78. Left = 60
  79. TabIndex = 3
  80. Top = 3120
  81. Width = 2055
  82. End
  83. Begin VB.Label lblValue
  84. Height = 255
  85. Index = 4
  86. Left = 2340
  87. TabIndex = 2
  88. Top = 3120
  89. Width = 3375
  90. End
  91. Begin VB.Label lblField
  92. Height = 255
  93. Index = 5
  94. Left = 60
  95. TabIndex = 1
  96. Top = 3840
  97. Width = 2055
  98. End
  99. Begin VB.Label lblValue
  100. Height = 255
  101. Index = 5
  102. Left = 2340
  103. TabIndex = 0
  104. Top = 3840
  105. Width = 3375
  106. End
  107. End
  108. Attribute VB_Name = "ppgDirStats"
  109. Attribute VB_GlobalNameSpace = False
  110. Attribute VB_Creatable = True
  111. Attribute VB_PredeclaredId = False
  112. Attribute VB_Exposed = True
  113. ' ===========================================================================
  114. ' | THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF |
  115. ' | ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
  116. ' | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A |
  117. ' | PARTICULAR PURPOSE. |
  118. ' | Copyright (c) 1998-1999 Microsoft Corporation |
  119. ' ===========================================================================
  120. ' =============================================================================
  121. ' File: ppgDirStats.pag
  122. ' Project: FileViewerExtensionProj
  123. ' Type: Property Page
  124. ' =============================================================================
  125. Option Explicit
  126. Implements IMMCPropertyPage
  127. ' When the property page is part of a multiple selection this variable holds the
  128. ' path of the particular folder for which the instance of the property page is being
  129. ' displayed.
  130. Private m_FolderPath As String
  131. ' MMC API DLL function declarations
  132. Private Declare Function MMCPropertyHelp Lib "mssnapr.dll" (ByVal HelpTopic As String) As Long
  133. ' =============================================================================
  134. ' Method: IMMCPropertyPage_Initialize
  135. ' Type: Interface method
  136. ' Description: Called when the property page is created to pass the last
  137. ' parameter from MMCPropertySheet.AddPage to the property page
  138. ' Parameters: Data The final parameter from MMCPropertySheet.AddPage
  139. ' Output: None
  140. ' Notes: Store the parameter as the folder path to be used in the
  141. ' PropertyPage_SelectionChanged() event.
  142. ' Unlike a UserControl property page, SelectedControls(0) will
  143. ' contain the MMCDataObject passed to
  144. ' ExtensionSnapIn_CreatePropertyPages so that the property page
  145. ' can access the data exported from the extended snap-in
  146. ' (FileExplorer in this case).
  147. ' =============================================================================
  148. '
  149. Private Sub IMMCPropertyPage_Initialize(ByVal Data As Variant, _
  150. ByVal PropertySheet As SnapInLib.MMCPropertySheet)
  151. On Error GoTo ErrTrap_IMMCPropertyPage_Initialize
  152. Dim FldrName As String
  153. Dim fs As New Scripting.FileSystemObject
  154. Dim Fldr As Scripting.Folder
  155. Dim FolderSize As Double
  156. Dim Fraction As Double
  157. m_FolderPath = Data
  158. ' Get a Folder object from the FileSystemObject for the folder and fill the
  159. ' property page fields with its data. The snap-in put the folder path into
  160. ' PropertyPage.Tag
  161. Set Fldr = fs.GetFolder(m_FolderPath)
  162. lblField(0).Caption = "Folder:"
  163. lblValue(0).Caption = Fldr.Path
  164. lblField(1).Caption = "Type:"
  165. lblValue(1).Caption = Fldr.Type
  166. lblField(2).Caption = "Size:"
  167. lblValue(2).Caption = Format(Fldr.Size, "#,##0 bytes")
  168. lblField(3).Caption = "Parent:"
  169. lblValue(3).Caption = Fldr.ParentFolder.Path
  170. lblField(4).Caption = "% of Parent Folder Size:"
  171. FolderSize = Fldr.Size
  172. Fraction = FolderSize / Fldr.ParentFolder.Size
  173. If Fraction < 0.01 Then
  174. lblValue(4).Caption = "< 1%"
  175. Else
  176. lblValue(4).Caption = Format(Fraction, "Percent")
  177. End If
  178. lblField(5).Caption = "% of Space on Disk:"
  179. Fraction = FolderSize / Fldr.Drive.TotalSize
  180. If Fraction < 0.01 Then
  181. lblValue(5).Caption = "< 1%"
  182. Else
  183. lblValue(5).Caption = Format(Fraction, "Percent")
  184. End If
  185. Exit Sub
  186. ' Error Handler for this method
  187. ErrTrap_IMMCPropertyPage_Initialize:
  188. DisplayError "IMMCPropertyPage_Initialize"
  189. End Sub
  190. ' =============================================================================
  191. ' Method: IMMCPropertyPage_Help
  192. ' Type: Interface method
  193. ' Description: Called when the user clicks the Help button on a property sheet
  194. '
  195. ' Parameters: None
  196. ' Output: None
  197. ' Notes: Calls the MMC API function MMCPropertyHelp() to display a topic
  198. ' from FileExlporer's merged help file.
  199. ' =============================================================================
  200. '
  201. Private Sub IMMCPropertyPage_Help()
  202. MMCPropertyHelp "VBSnapInsSamples.chm::VBSnapInsSamples/VBSnapInsSamples_35.htm"
  203. End Sub
  204. ' =============================================================================
  205. ' Method: IMMCPropertyPage_GetDialogUnitSize
  206. ' Type: Interface method
  207. ' Description: Called when the property page is about to be created to allow
  208. ' the page to specify its size in dialog units.
  209. '
  210. ' Parameters: None
  211. ' Output: None
  212. ' Notes: Returns the recommended height and width values for a snap-in
  213. ' property page.
  214. ' =============================================================================
  215. '
  216. Private Sub IMMCPropertyPage_GetDialogUnitSize(Height As Variant, Width As Variant)
  217. Height = 218
  218. Width = 252
  219. End Sub
  220. ' =============================================================================
  221. ' Method: IMMCPropertyPage_QueryCancel
  222. ' Type: Interface method
  223. ' Description: Called when the user cancels the property sheet or wizard by
  224. ' pressing Esc, clicking the Cancel button, or clicking the 'X'
  225. ' button in the upper right corner.
  226. '
  227. ' Parameters: Allow - set to False to prevent the sheet or wizard from closing.
  228. ' Output: None
  229. ' Notes: None
  230. ' =============================================================================
  231. '
  232. Private Sub IMMCPropertyPage_QueryCancel(Allow As Boolean)
  233. End Sub
  234. ' =============================================================================
  235. ' Method: IMMCPropertyPage_Cancel
  236. ' Type: Interface method
  237. ' Description: Called when a property sheet or wizard is closed because the
  238. ' user clicked the Cancel button.
  239. '
  240. ' Parameters: None
  241. ' Output: None
  242. ' Notes: None
  243. ' =============================================================================
  244. '
  245. Private Sub IMMCPropertyPage_Cancel()
  246. End Sub
  247. ' =============================================================================
  248. ' Method: IMMCPropertyPage_Close
  249. ' Type: Interface method
  250. ' Description: Called when a property sheet or wizard is closed because the
  251. ' user clicked the 'X' button in the upper right corner.
  252. '
  253. ' Parameters: None
  254. ' Output: None
  255. ' Notes: None
  256. ' =============================================================================
  257. '
  258. Private Sub IMMCPropertyPage_Close()
  259. End Sub
  260. ' =============================================================================
  261. ' Method: DisplayError
  262. ' Type: Subroutine
  263. ' Description: A method to format and display a runtime error
  264. ' Parameters: szLocation A string identifying the source location
  265. ' (i.e. method name) where the error occurred
  266. ' Output: None
  267. ' Notes: The error will be displayed in a messagebox formatted as the
  268. ' following sample:
  269. '
  270. ' Method: SomeMethodName
  271. ' Source: MMCListSubItems
  272. ' Error: 2527h (9511)
  273. ' Description: There is already an item in the collection that has the specified key
  274. '
  275. ' =============================================================================
  276. '
  277. Private Sub DisplayError(szLocation As String)
  278. MsgBox "Method:" & vbTab & vbTab & szLocation & vbCrLf _
  279. & "Source:" & vbTab & vbTab & Err.Source & vbCrLf _
  280. & "Error:" & vbTab & vbTab & Hex(Err.Number) & "h (" & CStr(Err.Number) & ")" & vbCrLf _
  281. & "Description:" & vbTab & Err.Description, _
  282. vbCritical, "FileViewerExtension Runtime Error"
  283. End Sub