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.
 
 
 
 
 
 

6474 lines
260 KiB

VERSION 5.00
Begin {B3E55942-FFD8-11D1-9788-44A620524153} FileExplorer
ClientHeight = 8775
ClientLeft = 0
ClientTop = 0
ClientWidth = 9285
_ExtentX = 16378
_ExtentY = 15478
m_iNextNodeNumber= 7
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ImageLists {FFF9A8F6-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {87BC1809-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "imgSmallFolders"
Index = 1
Key = "imgSmallFolders"
MaskColor = 8388736
BeginProperty ListImages {87BC180B-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 19
KeysOnly = 0
BeginProperty Item1 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = "0"
Picture = "FileExplorer.dsx":0000
EndProperty
BeginProperty Item2 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "2"
Tag = "0"
Picture = "FileExplorer.dsx":0352
EndProperty
BeginProperty Item3 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "3"
Tag = "0"
Picture = "FileExplorer.dsx":06A4
EndProperty
BeginProperty Item4 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "4"
Tag = "0"
Picture = "FileExplorer.dsx":09F6
EndProperty
BeginProperty Item5 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 5
Key = "5"
Tag = "0"
Picture = "FileExplorer.dsx":0D48
EndProperty
BeginProperty Item6 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 6
Key = "6"
Tag = "0"
Picture = "FileExplorer.dsx":109A
EndProperty
BeginProperty Item7 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 7
Key = "7"
Tag = "0"
Picture = "FileExplorer.dsx":13EC
EndProperty
BeginProperty Item8 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 8
Key = "8"
Tag = "0"
Picture = "FileExplorer.dsx":173E
EndProperty
BeginProperty Item9 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 9
Key = "9"
Tag = "0"
Picture = "FileExplorer.dsx":1A90
EndProperty
BeginProperty Item10 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 10
Key = "10"
Tag = "0"
Picture = "FileExplorer.dsx":1DE2
EndProperty
BeginProperty Item11 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 11
Key = "11"
Tag = "0"
Picture = "FileExplorer.dsx":2134
EndProperty
BeginProperty Item12 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 12
Key = "12"
Tag = "0"
Picture = "FileExplorer.dsx":2486
EndProperty
BeginProperty Item13 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 13
Key = "13"
Tag = "0"
Picture = "FileExplorer.dsx":27D8
EndProperty
BeginProperty Item14 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 14
Key = "14"
Tag = "0"
Picture = "FileExplorer.dsx":2B2A
EndProperty
BeginProperty Item15 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 15
Key = "15"
Tag = "0"
Picture = "FileExplorer.dsx":2E7C
EndProperty
BeginProperty Item16 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 16
Key = "16"
Tag = "0"
Picture = "FileExplorer.dsx":31CE
EndProperty
BeginProperty Item17 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 17
Key = "17"
Tag = "0"
Picture = "FileExplorer.dsx":3520
EndProperty
BeginProperty Item18 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 18
Key = "18"
Tag = "0"
Picture = "FileExplorer.dsx":3872
EndProperty
BeginProperty Item19 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 19
Key = "19"
Tag = "0"
Picture = "FileExplorer.dsx":3BC4
EndProperty
EndProperty
DISPID = 1000
EndProperty
BeginProperty Item2 {87BC1809-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "imgSmallOpenFolders"
Index = 2
Key = "imgSmallOpenFolders"
MaskColor = 8388736
BeginProperty ListImages {87BC180B-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 19
KeysOnly = 0
BeginProperty Item1 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = "0"
Picture = "FileExplorer.dsx":3F16
EndProperty
BeginProperty Item2 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "2"
Tag = "0"
Picture = "FileExplorer.dsx":4268
EndProperty
BeginProperty Item3 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "3"
Tag = "0"
Picture = "FileExplorer.dsx":45BA
EndProperty
BeginProperty Item4 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "4"
Tag = "0"
Picture = "FileExplorer.dsx":490C
EndProperty
BeginProperty Item5 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 5
Key = "5"
Tag = "0"
Picture = "FileExplorer.dsx":4C5E
EndProperty
BeginProperty Item6 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 6
Key = "6"
Tag = "0"
Picture = "FileExplorer.dsx":4FB0
EndProperty
BeginProperty Item7 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 7
Key = "7"
Tag = "0"
Picture = "FileExplorer.dsx":5302
EndProperty
BeginProperty Item8 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 8
Key = "8"
Tag = "0"
Picture = "FileExplorer.dsx":5654
EndProperty
BeginProperty Item9 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 9
Key = "9"
Tag = "0"
Picture = "FileExplorer.dsx":59A6
EndProperty
BeginProperty Item10 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 10
Key = "10"
Tag = "0"
Picture = "FileExplorer.dsx":5CF8
EndProperty
BeginProperty Item11 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 11
Key = "11"
Tag = "0"
Picture = "FileExplorer.dsx":604A
EndProperty
BeginProperty Item12 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 12
Key = "12"
Tag = "0"
Picture = "FileExplorer.dsx":639C
EndProperty
BeginProperty Item13 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 13
Key = "13"
Tag = "0"
Picture = "FileExplorer.dsx":66EE
EndProperty
BeginProperty Item14 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 14
Key = "14"
Tag = "0"
Picture = "FileExplorer.dsx":6A40
EndProperty
BeginProperty Item15 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 15
Key = "15"
Tag = "0"
Picture = "FileExplorer.dsx":6D92
EndProperty
BeginProperty Item16 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 16
Key = "16"
Tag = "0"
Picture = "FileExplorer.dsx":70E4
EndProperty
BeginProperty Item17 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 17
Key = "17"
Tag = "0"
Picture = "FileExplorer.dsx":7436
EndProperty
BeginProperty Item18 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 18
Key = "18"
Tag = "0"
Picture = "FileExplorer.dsx":7788
EndProperty
BeginProperty Item19 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 19
Key = "19"
Tag = "0"
Picture = "FileExplorer.dsx":7ADA
EndProperty
EndProperty
DISPID = 1001
EndProperty
BeginProperty Item3 {87BC1809-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "imgLargeFolders"
Index = 3
Key = "imgLargeFolders"
MaskColor = 8388736
BeginProperty ListImages {87BC180B-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 19
KeysOnly = 0
BeginProperty Item1 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = "0"
Picture = "FileExplorer.dsx":7E2C
EndProperty
BeginProperty Item2 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "2"
Tag = "0"
Picture = "FileExplorer.dsx":8A7E
EndProperty
BeginProperty Item3 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "3"
Tag = "0"
Picture = "FileExplorer.dsx":96D0
EndProperty
BeginProperty Item4 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "4"
Tag = "0"
Picture = "FileExplorer.dsx":A322
EndProperty
BeginProperty Item5 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 5
Key = "5"
Tag = "0"
Picture = "FileExplorer.dsx":AF74
EndProperty
BeginProperty Item6 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 6
Key = "6"
Tag = "0"
Picture = "FileExplorer.dsx":BBC6
EndProperty
BeginProperty Item7 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 7
Key = "7"
Tag = "0"
Picture = "FileExplorer.dsx":C818
EndProperty
BeginProperty Item8 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 8
Key = "8"
Tag = "0"
Picture = "FileExplorer.dsx":D46A
EndProperty
BeginProperty Item9 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 9
Key = "9"
Tag = "0"
Picture = "FileExplorer.dsx":E0BC
EndProperty
BeginProperty Item10 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 10
Key = "10"
Tag = "0"
Picture = "FileExplorer.dsx":ED0E
EndProperty
BeginProperty Item11 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 11
Key = "11"
Tag = "0"
Picture = "FileExplorer.dsx":F960
EndProperty
BeginProperty Item12 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 12
Key = "12"
Tag = "0"
Picture = "FileExplorer.dsx":105B2
EndProperty
BeginProperty Item13 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 13
Key = "13"
Tag = "0"
Picture = "FileExplorer.dsx":11204
EndProperty
BeginProperty Item14 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 14
Key = "14"
Tag = "0"
Picture = "FileExplorer.dsx":11E56
EndProperty
BeginProperty Item15 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 15
Key = "15"
Tag = "0"
Picture = "FileExplorer.dsx":12AA8
EndProperty
BeginProperty Item16 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 16
Key = "16"
Tag = "0"
Picture = "FileExplorer.dsx":136FA
EndProperty
BeginProperty Item17 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 17
Key = "17"
Tag = "0"
Picture = "FileExplorer.dsx":1434C
EndProperty
BeginProperty Item18 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 18
Key = "18"
Tag = "0"
Picture = "FileExplorer.dsx":14F9E
EndProperty
BeginProperty Item19 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 19
Key = "19"
Tag = "0"
Picture = "FileExplorer.dsx":15BF0
EndProperty
EndProperty
DISPID = 1002
EndProperty
BeginProperty Item4 {87BC1809-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "imgButtons"
Index = 4
Key = "imgButtons"
MaskColor = 8388736
BeginProperty ListImages {87BC180B-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 5
KeysOnly = 0
BeginProperty Item1 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = "0"
Picture = "FileExplorer.dsx":16842
EndProperty
BeginProperty Item2 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "2"
Tag = "0"
Picture = "FileExplorer.dsx":16B94
EndProperty
BeginProperty Item3 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "3"
Tag = "0"
Picture = "FileExplorer.dsx":16EE6
EndProperty
BeginProperty Item4 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "4"
Tag = "0"
Picture = "FileExplorer.dsx":17238
EndProperty
BeginProperty Item5 {87BC180D-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 5
Key = "5"
Tag = "0"
Picture = "FileExplorer.dsx":1758A
EndProperty
EndProperty
DISPID = 1003
EndProperty
EndProperty
BeginProperty Menus {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Menu1"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 1
Name = "mnuContext"
Tag = 0
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 2
KeysOnly = 0
BeginProperty Item1 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Run"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 1
Name = "mnuRun"
Tag = 0
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "4"
DISPID = 1011
EndProperty
BeginProperty Item2 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "RunAs"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 2
Name = "mnuRunAs"
Tag = 0
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "5"
DISPID = 1012
EndProperty
EndProperty
Key = "1"
DISPID = 1007
EndProperty
BeginProperty Item2 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Menu1"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 2
Name = "mnuNew"
Tag = 0
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Folder"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 1
Name = "mnuNewFolder"
Tag = 0
StatusBarText = "Creates a new foolder under the selected folder"
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "1"
DISPID = 1016
EndProperty
EndProperty
Key = "2"
DISPID = 1015
EndProperty
BeginProperty Item3 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Menu1"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 3
Name = "mnuFilterOp"
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 2
KeysOnly = 0
BeginProperty Item1 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Filter by name"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 1
Name = "mnuFilterByName"
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "Menu1"
DISPID = 1018
EndProperty
BeginProperty Item2 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Filter by extension"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 2
Name = "mnuFilterByExt"
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "Menu1"
DISPID = 1019
EndProperty
EndProperty
Key = "Menu1"
DISPID = 1017
EndProperty
BeginProperty Item4 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "Menu1"
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 4
Name = "mnuNewURL"
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {91CC37D5-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Caption = "URL..."
Visible = -1
Checked = 0
Enabled = -1
Grayed = 0
MenuBreak = 0
MenuBarBreak = 0
Default = 0
Index = 1
Name = "mnuURL"
StatusBarText = ""
BeginProperty Children {11517450-27FE-11D3-AA41-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Key = "Menu1"
DISPID = 1021
EndProperty
EndProperty
Key = "Menu1"
DISPID = 1020
EndProperty
EndProperty
BeginProperty Toolbars {FFF9A8FA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 2
KeysOnly = 0
BeginProperty Item1 {91CC37E1-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "tbrFileMgr"
Name = "tbrFileMgr"
Tag = "0"
BeginProperty Buttons {8B034115-FBB2-11D1-9785-EAA220524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 3
KeysOnly = 0
BeginProperty Item1 {91CC37E6-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ButtonMenus {91CC37E7-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Caption = "Add"
Enabled = -1
Image = 1
Index = 1
Key = "1"
MixedState = 0
Style = 0
Tag = ""
ToolTipText = "Add a new folder"
Value = 0
Visible = -1
EndProperty
BeginProperty Item2 {91CC37E6-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ButtonMenus {91CC37E7-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Caption = "Run"
Enabled = -1
Image = 4
Index = 2
Key = "2"
MixedState = 0
Style = 0
Tag = ""
ToolTipText = "Run"
Value = 0
Visible = -1
EndProperty
BeginProperty Item3 {91CC37E6-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ButtonMenus {91CC37E7-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Caption = "RunAs"
Enabled = -1
Image = 5
Index = 3
Key = "3"
MixedState = 0
Style = 0
Tag = ""
ToolTipText = "Run with a special command line"
Value = 0
Visible = -1
EndProperty
EndProperty
Images = "imgButtons"
DISPID = 1005
EndProperty
BeginProperty Item2 {91CC37E1-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "tbrMenuButton"
Name = "tbrMenuButton"
Tag = "0"
BeginProperty Buttons {8B034115-FBB2-11D1-9785-EAA220524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {91CC37E6-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ButtonMenus {91CC37E7-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {91CC37E9-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Enabled = -1
Index = 1
Key = "1"
Tag = ""
Text = "New Folder"
Visible = -1
Checked = 0
Grayed = -1
Separator = 0
MenuBreak = 0
MenuBarBreak = 0
EndProperty
BeginProperty Item2 {91CC37E9-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Enabled = -1
Index = 2
Key = "2"
Tag = ""
Text = "Run"
Visible = -1
Checked = 0
Grayed = -1
Separator = 0
MenuBreak = 0
MenuBarBreak = 0
EndProperty
BeginProperty Item3 {91CC37E9-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Enabled = -1
Index = 3
Key = "3"
Tag = ""
Text = "Run As..."
Visible = -1
Checked = 0
Grayed = -1
Separator = 0
MenuBreak = 0
MenuBarBreak = 0
EndProperty
BeginProperty Item4 {91CC37E9-CE2B-11D1-B44D-7E92AF000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Enabled = -1
Index = 4
Key = "4"
Tag = ""
Text = "Configuration..."
Visible = -1
Checked = 0
Grayed = 0
Separator = 0
MenuBreak = 0
MenuBarBreak = 0
EndProperty
EndProperty
Caption = "Explorer"
Enabled = -1
Image = 1
Index = 1
Key = ""
MixedState = 0
Style = 16
Tag = ""
ToolTipText = "File Explorer Actions"
Value = 0
Visible = -1
EndProperty
EndProperty
Images = "imgButtons"
DISPID = 1006
EndProperty
EndProperty
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 3
KeysOnly = 0
BeginProperty Item1 {FFF9A8EC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "lvExplorerFiles"
Name = "lvExplorerFiles"
AddToViewMenu = 0
ViewMenuText = ""
ViewMenuStatusBarText= ""
DefaultItemTypeGUID= "{D2B294B2-9F64-11d2-97E1-00104B880587}"
Extensible = -1
BeginProperty ListView {87BC180F-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = 0
Text = "Name"
Object.Width = 175
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item2 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "2"
Tag = 0
Text = "Size"
Object.Width = 125
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item3 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "3"
Tag = 0
Text = "Date"
Object.Width = 125
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item4 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "4"
Tag = 0
Text = "Attributes"
Object.Width = 75
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
EndProperty
Icons = "imgLargeFolders"
SmallIcons = "imgSmallFolders"
Sorted = 0
SortKey = 1
SortOrder = 0
View = 4
Tag = 0
Virtual = 0
UseFontLinking = 0
MultiSelect = -1
HideSelection = 0
SortHeader = -1
SortIcon = -1
FilterChangeTimeout= 500
ShowChildScopeItems= -1
LexicalSort = 0
EndProperty
EndProperty
BeginProperty Item2 {FFF9A8EC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "lvExplorerMain"
Name = "lvExplorerMain"
AddToViewMenu = 0
ViewMenuText = ""
ViewMenuStatusBarText= ""
DefaultItemTypeGUID= "{D2B294B3-9F64-11d2-97E1-00104B880587}"
Extensible = 0
BeginProperty ListView {87BC180F-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = 0
Text = "Name"
Object.Width = 150
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item2 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "5"
Tag = 0
Text = "Type"
Object.Width = 100
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item3 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "6"
Tag = 0
Text = "Total Size"
Object.Width = 100
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
BeginProperty Item4 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "7"
Tag = 0
Text = "Free Space"
Object.Width = 100
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
EndProperty
Icons = "imgLargeFolders"
SmallIcons = "imgSmallFolders"
Sorted = 0
SortKey = 0
SortOrder = 0
View = 3
Tag = 0
Virtual = 0
UseFontLinking = 0
MultiSelect = 0
HideSelection = 0
SortHeader = -1
SortIcon = -1
FilterChangeTimeout= 500
ShowChildScopeItems= -1
LexicalSort = 0
EndProperty
EndProperty
BeginProperty Item3 {FFF9A8EC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "lvExplorerTop"
Name = "lvExplorerTop"
AddToViewMenu = -1
ViewMenuText = "File Explorer"
ViewMenuStatusBarText= "Start Using File Explorer"
DefaultItemTypeGUID= "{D2B294B5-9F64-11d2-97E1-00104B880587}"
Extensible = 0
BeginProperty ListView {87BC180F-C8FB-11D1-B44A-30F4BC000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {3B15D613-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "1"
Tag = 0
Text = "Name"
Object.Width = 200
Alignment = 0
Hidden = 0
TextFilter = ""
TextFilterMaxLen= 260
NumericFilter = ""
EndProperty
EndProperty
Icons = "imgLargeFolders"
SmallIcons = "imgSmallFolders"
Sorted = 0
SortKey = 0
SortOrder = 0
View = 0
Tag = 0
Virtual = 0
UseFontLinking = 0
MultiSelect = 0
HideSelection = 0
SortHeader = -1
SortIcon = -1
FilterChangeTimeout= 500
ShowChildScopeItems= -1
LexicalSort = 0
EndProperty
EndProperty
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {FFF9A8EE-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "ovAbout"
Name = "ovAbout"
Tag = 0
AddToViewMenu = -1
ViewMenuText = "About..."
ViewMenuStatusBarText= "About File Explorer"
ProgID = "FileExplorerSample.AboutCtl"
AlwaysCreateNewOCX= -1
EndProperty
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {FFF9A8F2-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "StaticNodeTaskpad"
Index = 1
Key = "StaticNodeTaskpad"
AddToViewMenu = -1
ViewMenuText = "Welcome to File Explorer"
ViewMenuStatusBarText= "First Time Users Select this View"
UseWhenTaskpadViewPreferred= -1
BeginProperty Taskpad {861481F2-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "StaticNodeTaskpad"
Type = 3
Title = "File Explorer"
URL = ""
DescriptiveText = "Welcome to the Visual Basic Snap-in Sample"
BackgroundType = 1
MouseOverImage = ""
MouseOffImage = ""
FontFamily = "GLYPH 100"
EOTFile = "res://mmc.exe/glyph100.eot"
SymbolString = "4"
ListpadStyle = 1
ListpadTitle = ""
ListpadHasButton= 0
ListpadButtonText= ""
ListView = ""
BeginProperty Tasks {861481F4-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 4
KeysOnly = 0
BeginProperty Item1 {861481F7-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 1
Key = "UserGuide"
Visible = -1
Tag = 0
Text = "How to Use the File Explorer"
ImageType = 1
MouseOverImage = ""
MouseOffImage = ""
FontFamily = "GLYPH 100"
EOTFile = "res://mmc.exe/glyph100.eot"
SymbolString = "T"
HelpString = "First Time Users Click Here"
ActionType = 1
URL = "CUSTOM/USERGUIDE"
Script = ""
EndProperty
BeginProperty Item2 {861481F7-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 2
Key = "Start"
Visible = -1
Tag = 0
Text = "Start File Explorer"
ImageType = 1
MouseOverImage = ""
MouseOffImage = ""
FontFamily = "GLYPH 100"
EOTFile = "res://mmc.exe/glyph100.eot"
SymbolString = "4"
HelpString = "Experienced Users Click Here"
ActionType = 0
URL = ""
Script = ""
EndProperty
BeginProperty Item3 {861481F7-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 3
Key = "mmchome"
Visible = -1
Tag = 0
Text = "MMC Home Page"
ImageType = 1
MouseOverImage = ""
MouseOffImage = ""
FontFamily = "GLYPH 100"
EOTFile = "res://mmc.exe/glyph100.eot"
SymbolString = ":"
HelpString = "Go to the MMC home page on microsoft.com"
ActionType = 0
URL = ""
Script = ""
EndProperty
BeginProperty Item4 {861481F7-D867-11D1-B450-C43058000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Index = 4
Key = "About"
Visible = -1
Tag = 0
Text = "About..."
ImageType = 1
MouseOverImage = ""
MouseOffImage = ""
FontFamily = "GLYPH 100"
EOTFile = "res://mmc.exe/glyph100.eot"
SymbolString = "T"
HelpString = "About File Explorer"
ActionType = 0
URL = ""
Script = ""
EndProperty
EndProperty
EndProperty
EndProperty
EndProperty
EndProperty
BeginProperty DataFormats {91FE14C5-7370-11D2-97D8-00104B880587}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
BeginProperty SnapInDef {FFF9A8E4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "FileExplorer"
NodeTypeName = "FileExplorer"
NodeTypeGUID = "{873CAEF3-4DA3-11D2-8873-0080C7E0ACE4}"
DisplayName = "File Explorer"
Type = 2
HelpFile = "mmc.chm"
LinkedTopics = ""
Description = "Snap-in designer sample"
Provider = "Microsoft Corporation"
Version = "1.0"
SmallFolders = "imgSmallFolders"
SmallFoldersOpen= "imgSmallOpenFolders"
LargeFolders = "imgLargeFolders"
Icon = "FileExplorer.dsx":178DC
Watermark = "FileExplorer.dsx":17BF6
Header = "FileExplorer.dsx":89B88
Palette = "FileExplorer.dsx":9F006
StretchWatermark= 0
StaticFolder = "19"
DefaultView = "lvExplorerTop"
Extensible = -1
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "lvExplorerTop"
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "StaticNodeTaskpad"
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
IID = "{04750E57-FD3C-4079-9FDB-B3E444539906}"
Preload = 0
EndProperty
BeginProperty ExtensionDefs {FFF9A8E6-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
ExtendsNewMenu = -1
ExtendsTaskMenu = 0
ExtendsTopMenu = -1
ExtendsViewMenu = -1
ExtendsPropertyPages= -1
ExtendsToolbar = -1
ExtendsNameSpace= -1
BeginProperty ExtendedSnapIns {BDA4B9D1-0872-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {FFF9A8E8-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = ""
Index = 1
Key = "{476e6448-aaff-11d0-b944-00c04fd8d5b0}"
CLSID = "{476e6448-aaff-11d0-b944-00c04fd8d5b0}"
DisplayName = ""
Dynamic = 0
ExtendsNameSpace= -1
ExtendsNewMenu = 0
ExtendsTaskMenu = 0
ExtendsPropertyPages= 0
ExtendsToolbar = 0
ExtendsTaskpad = 0
EndProperty
EndProperty
EndProperty
BeginProperty AutoCreateNodes {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 0
BeginProperty Item1 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "Desktop"
Index = 1
Key = "Desktop"
NodeTypeName = "Desktop"
NodeTypeGUID = "{873CAEFD-4DA3-11D2-8873-0080C7E0ACE4}"
DisplayName = "Desktop"
Folder = "1"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = "lvExplorerFiles"
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "lvExplorerFiles"
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 6
KeysOnly = 0
BeginProperty Item1 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "MyComputer"
Index = 1
Key = "MyComputer"
NodeTypeName = "MyComputer"
NodeTypeGUID = "{119067B6-4DBC-11D2-8873-0080C7E0ACE4}"
DisplayName = "My Computer"
Folder = "2"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = "lvExplorerMain"
HasChildren = -1
Extensible = -1
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "lvExplorerMain"
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "MyComputer"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item2 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "InternetExplorer"
Index = 2
Key = "InternetExplorer"
NodeTypeName = "InternetExplorer"
NodeTypeGUID = "{1EF2C7CA-5299-11D2-887B-0080C7E0ACE4}"
DisplayName = "Internet Explorer"
Folder = "13"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = "uvBrowser"
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "InternetExplorer"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item3 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "NetworkNeighborhood"
Index = 3
Key = "NetworkNeighborhood"
NodeTypeName = "NetworkNeighborhood"
NodeTypeGUID = "{1EF2C7CB-5299-11D2-887B-0080C7E0ACE4}"
DisplayName = "Network Neighborhood"
Folder = "14"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = ""
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "NetworkNeighborhood"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item4 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "RecycleBin"
Index = 4
Key = "RecycleBin"
NodeTypeName = "RecycleBin"
NodeTypeGUID = "{1EF2C7D0-5299-11D2-887B-0080C7E0ACE4}"
DisplayName = "Recycle Bin"
Folder = "15"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = ""
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "RecycleBin"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item5 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "MyBriefcase"
Index = 5
Key = "MyBriefcase"
NodeTypeName = "MyBriefcase"
NodeTypeGUID = "{1EF2C7D1-5299-11D2-887B-0080C7E0ACE4}"
DisplayName = "My Briefcase"
Folder = "16"
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = ""
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "MyBriefcase"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item6 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "About"
Index = 6
Key = "About"
NodeTypeName = "About"
NodeTypeGUID = "{74F84006-618B-4B3B-9EF3-C23E0723FA9D}"
DisplayName = "About FileExplorer"
Folder = 19
DefaultDataFormat= ""
AutoCreate = -1
DefaultView = "ovAbout"
HasChildren = -1
Extensible = -1
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "ovAbout"
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
EndProperty
Tag = "Desktop"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
EndProperty
BeginProperty OtherNodes {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 2
KeysOnly = 0
BeginProperty Item1 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "Directory"
Index = 1
Key = "Directory"
NodeTypeName = "Directory"
NodeTypeGUID = "{119067F7-4DBC-11D2-8873-0080C7E0ACE4}"
DisplayName = "Directory"
Folder = "6"
DefaultDataFormat= ""
AutoCreate = 0
DefaultView = "lvExplorerFiles"
HasChildren = -1
Extensible = -1
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "lvExplorerFiles"
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = "Directory"
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
BeginProperty Item2 {FFF9A8EA-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Name = "ExtensionRoot"
Index = 2
Key = "ExtensionRoot"
NodeTypeName = "ExtensionRoot"
NodeTypeGUID = "{2F6E942D-A3EB-11D2-97E4-00104B880587}"
DisplayName = "File Explorer"
Folder = "19"
DefaultDataFormat= ""
AutoCreate = 0
DefaultView = "lvExplorerTop"
HasChildren = -1
Extensible = 0
BeginProperty ViewDefs {FFF9A8E1-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
BeginProperty ListViews {FFF9A8FC-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "lvExplorerTop"
EndProperty
BeginProperty OCXViews {FFF9A8FF-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty URLViews {FFF9A902-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 1
EndProperty
BeginProperty TaskpadViews {FFF9A904-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 1
KeysOnly = 1
Item1 = "StaticNodeTaskpad"
EndProperty
EndProperty
BeginProperty Children {FFF9A8F4-06CB-11D2-9791-50C320524153}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
Tag = 0
BeginProperty ColumnHeaders {3B15D611-CD57-11D1-B44C-44750B000000}
Persistence.MajorVersion= 0
Persistence.MinorVersion= 12
Count = 0
KeysOnly = 0
EndProperty
EndProperty
EndProperty
TypeinfoCookie = 199
ProjectName = "FileExplorerSample"
End
Attribute VB_Name = "FileExplorer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' ===========================================================================
' | THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF |
' | ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
' | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A |
' | PARTICULAR PURPOSE. |
' | Copyright (c) 1998-1999 Microsoft Corporation |
' ===========================================================================
' =============================================================================
' File: FileExplorer.dsr
' Project: FileExplorerSample
' Type: SnapIn Designer
' =============================================================================
Option Explicit
' Create the FileSystemObject once and hold onto it. Since this object
' will be used repeatedly, it is more convenient to have it as a global.
' This will not necessarily improve performance, as this is a UI-based
' component and the cycles used on creation/destruction of the object
' will be insignificant relative to the user's interaction.
Private m_FileSystemObject As New Scripting.FileSystemObject
' Create the configuration object once and hold onto it. This object has
' properties that hold the settings gathered by the configuration wizard
' property pages.
Private m_ConfigData As New ConfigData
' These variables hold the current filter operator. They are mutually exclusive i.e. one
' is always True and one is always False. The default is to filter by name.
Private m_FilterByName As Boolean
Private m_FilterByExt As Boolean
' This variable holds the current filter value. The default is "*"
Private m_FilterValue As String
Const S_OK = 0&
Const S_FALSE = 1&
' Definitions of all literal strings needed
' These are node type names
Const SZ_DIRECTORY = "Directory"
Const SZ_EXTENSION_ROOT = "ExtensionRoot"
Const SZ_STATICNODE = "Static Node"
Const SZ_DESKTOP = "Desktop"
Const SZ_MYCOMPUTER = "MyComputer"
Const SZ_INTERNETEXPLORER = "InternetExplorer"
Const SZ_NETWORKNEIGHBORHOOD = "NetworkNeighborhood"
Const SZ_RECYCLEBIN = "RecycleBin"
Const SZ_MYBRIEFCASE = "MyBriefcase"
Const SZ_DRIVENODE = "Drive Node"
Const SZ_ABOUT = "About"
' Key values for toolbar buttons, menu buttons, and menu items.
Const KEY_ADD = "1"
Const KEY_RUN = "2"
Const KEY_RUNAS = "3"
Const KEY_CONFIGURATION = "4"
' Key values for images
Const KEY_DESKTOP = "1"
Const KEY_MYCOMPUTER = "2"
Const KEY_FLOPPYDRIVE = "3"
Const KEY_LOCALDRIVE = "4"
Const KEY_CDROM = "5"
Const KEY_FOLDER = "6"
Const KEY_REMOTEDRIVE = "7"
Const KEY_REMOTEDRIVEOFFLINE = "8"
Const KEY_FILE = "9"
Const KEY_APPLICATION = "10"
Const KEY_APPEXTENSION = "11"
Const KEY_UNKNOWN = "12"
Const KEY_INTERNETEXPLORER = "13"
Const KEY_NETWORKNEIGHBORHOOD = "14"
Const KEY_RECYCLEBIN = "15"
Const KEY_MYBRIEFCASE = "16"
Const KEY_FOLDERGRAY = "17"
Const KEY_FILEGRAY = "18"
Const KEY_EXPLORER = "19"
' Display names
Const SZDISPLAY_FLOPPYDRIVE = "Floppy Disk"
Const SZDISPLAY_LOCALDRIVE = "Local Disk"
Const SZDISPLAY_CDROM = "CD-ROM Disk"
Const SZDISPLAY_REMOTEDRIVE = "Network Connection"
Const SZDISPLAY_UNKNOWN = "Unknown Type"
Const SZDISPLAY_DESKTOP = "Desktop"
Const SZDISPLAY_MYCOMPUTER = "My Computer"
Const SZDISPLAY_SYSTEMFOLDER = "System Folder"
Const SZDISPLAY_FOLDER = "File Folder"
Const SZDISPLAY_REMOTEDRIVEOFFLINE = "Network Connection"
Const SZDISPLAY_FILE = " File"
Const SZDISPLAY_APPLICATION = "Application"
Const SZDISPLAY_APPEXTENSION = "Application Extension"
Const SZDISPLAY_INTERNETEXPLORER = "Internet Explorer"
Const SZDISPLAY_NETWORKNEIGHBORHOOD = "Network Neighborhood"
Const SZDISPLAY_RECYCLEBIN = "Recycle Bin"
Const SZDISPLAY_MYBRIEFCASE = "My Briefcase"
' Column keys for detail view
Const KEY_NAME = "1"
Const COLNUM_NAME = 1
Const KEY_TYPE = "5"
Const KEY_TOTALSIZE = "6"
Const COLNUM_TOTALSIZE = 3
Const KEY_FREESPACE = "7"
Const COLNUM_FREESPACE = 4
Const KEY_SIZE = "2"
Const COLNUM_SIZE = 2
Const KEY_DATE = "3"
Const COLNUM_DATE = 3
Const KEY_ATTRIBUTES = "4"
' Column header text
Const SZDISPLAY_NAME = "Name"
Const SZDISPLAY_SIZE = "Size"
Const SZDISPLAY_DATE = "Date Modified"
Const SZDISPLAY_TOTALSIZE = "Total Size"
Const SZDISPLAY_FREESPACE = "Free Space"
Const SZDISPLAY_ATTRIBUTES = "Attributes"
Const SZDISPLAY_TYPE = "Type"
' Static node taskpad task keys
Const KEY_START = "Start"
Const KEY_MMC_HOME_PAGE = "mmchome"
Const KEY_ABOUT = "About"
' ResultView names
Const SZ_STATIC_NODE_TASKPAD = "StaticNodeTaskpad"
Const SZ_ABOUT_OCX = "ovAbout"
' Shell library constants
Const SW_SHOWNORMAL = 1
Const MAX_PATH = 260
Const CSIDL_DESKTOP = 0
' Potential error values returned from ShellExecute
Const ERROR_FILE_NOT_FOUND = 2&
Const ERROR_PATH_NOT_FOUND = 3&
Const ERROR_BAD_FORMAT = 11&
Const SE_ERR_FNF = 2&
Const SE_ERR_PNF = 3&
Const SE_ERR_ACCESSDENIED = 5&
Const SE_ERR_OOM = 8&
Const SE_ERR_SHARE = 26&
Const SE_ERR_ASSOCINCOMPLETE = 27&
Const SE_ERR_DDETIMEOUT = 28&
Const SE_ERR_DDEFAIL = 29&
Const SE_ERR_DDEBUSY = 30&
Const SE_ERR_NOASSOC = 31&
Const SE_ERR_DLLNOTFOUND = 32&
' Format specifiers for file dates and sizes
Const SIZE_FORMAT_SPECIFIER = "##,##0"
Const DATE_FORMAT_SPECIFIER = "M/D/YY HH:MM AMPM"
Const GIGA_FORMAT_SPECIFIER = "#,##0.0 GB"
Const MEGA_FORMAT_SPECIFIER = "#,##0 MB"
Const KILO_FORMAT_SPECIFIER = "#,##0 KB"
Const BYTE_FORMAT_SPECIFIER = "#,##0 bytes"
Const GIGABYTE = 2 ^ 30
Const MEGABYTE = 2 ^ 20
Const KILOBYTE = 2 ^ 10
' Error message strings
Const SZ_ERRTITLE = "FileExplorer Runtime Error"
Const SZ_ERRSHELLEXEC = "FileExplorer Application Launch Error"
' Shell library DLL function declarations
Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal Path As String) As Long
Private Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As Long, ByVal ProcName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32.dll" (ByVal hModule As Long)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function SHGetSpecialFolderPath Lib "shell32.dll" Alias "SHGetSpecialFolderPathA" (ByVal hwnd As Long, ByVal lpPath As String, ByVal nFolder As Long, ByVal fCreate As Boolean) As Long
' =============================================================================
' Method: AddDrivesToScope
' Type: Subroutine
' Description: Enumerate all the disk drives located on this computer
' (using the FileSystemObject) and add a scope item for
' each drive.
' Parameters: nodeParent The ScopeNode under which to insert
' the scope items
' Output: None
' Notes: This method is called as part of the processing for
' the ScopeItems_Expand event, when the node being expanded
' is "MyComputer". By the time this method has been called,
' we have reached the last of our pre-defined, auto-created nodes.
' We use the FileSystemObject to provide the list of drives
' available, and we create a new ScopeItem for each.
'
' The MyComputer ScopeItem is extensible and it exports a data
' format called "Drives" that contains a string array of the
' drive names being displayed in FileExplorer. The DriveStats
' extension will use that format to display its listpad as the
' result view for the <Stats> node it adds under "My Computer".
' =============================================================================
'
Private Sub AddDrivesToScope(nodeParent As ScopeNode)
On Error GoTo ErrTrap_AddDrivesToScope
Dim Drives As Drives ' the Drives collection
Dim Drive As Drive ' empty drive object for For...Each
Dim DriveScopeItem As ScopeItem ' reference to the newly added ScopeItem
Dim szDisplay As String ' display text for scope pane node
Dim szType As String ' display text for type of drive
Dim szDriveNames() As String ' array of drive names for exported data
Dim cDrives As Integer ' count of drives displayed
cDrives = 0
' Get the drives collection...
Set Drives = m_FileSystemObject.Drives
' ...and start to step through the list
For Each Drive In Drives
' If this is a remote drive then check configuration data gathered
' during the configuration wizard to determine whether to add it.
If (Drive.DriveType <> Remote) Or (m_ConfigData.ShowNetDrives) Then
' Add the drive name to the array for MyComputer's exported data
cDrives = cDrives + 1
ReDim Preserve szDriveNames(1 To cDrives) As String
szDriveNames(cDrives) = Drive.Path
' Build the display string for the drive nodes
szDisplay = "(" & Drive.Path & ")"
' There is only one global ScopeItems collection, and it is
' a property of the snap-in itself. As such, it is globally
' available to be referenced.
Set DriveScopeItem = ScopeItems.AddPreDefined(SZ_DIRECTORY, Drive.Path & "\", nodeParent, siParent)
With DriveScopeItem
' Set the NodeID to the path as that is a unique non-localized string that can
' identify the node in the scope pane. Set SlowRetrieval to False so that
' when a console file is reloaded the same scope item will be selected.
.NodeID = Drive.Path
.SlowRetrieval = False
' Set exported data: Format is "Drive", data is drive name
.Data.SetData Drive.Path, "Drive"
' Enable the DriveStats dynamic extension for this scope item.
' This is indexed by CLSID as node type names are not guaranteed to be registered
' or unique.
.DynamicExtensions("{8A7A7E11-A8AC-11D2-97E5-00104B880587}").NameSpaceEnabled = True
' We have to separately set the displayed text for this new ScopeItem
' through its ScopeNode.
.ScopeNode.DisplayName = szDisplay
' When displaying properties for the node we need to know
' what it represents so set ScopeItem.Tag to the Drive object
Set .Tag = Drive
' Assign the appropriate bitmap and type description to the
' new ScopeItem, depending on what kind of drive it is.
Select Case Drive.DriveType
Case Removable
.Folder = KEY_FLOPPYDRIVE
szType = SZDISPLAY_FLOPPYDRIVE
Case Fixed
.Folder = KEY_LOCALDRIVE
szType = SZDISPLAY_LOCALDRIVE
Case CDRom
.Folder = KEY_CDROM
szType = SZDISPLAY_CDROM
Case Remote
.Folder = KEY_REMOTEDRIVE
szType = SZDISPLAY_REMOTEDRIVE
Case Else
' This is just a catch-all for anything that comes through
' that we don't expect or know how to deal with.
.Folder = KEY_UNKNOWN
szType = SZDISPLAY_UNKNOWN
End Select ' Drive.DriveType
' The key for each item will be the fully
' qualified pathname. This is guaranteed to be unique,
' we don't have to create anything new, and we can easily
' make use of this in other parts of the code
.Key = Drive.Path & "\"
' ColumnHeader objects define each of the columns shown in a ListView
' when the view mode is set to Report. ListSubItems CAN'T be added to
' a ListView unless there have been ColumnHeaders defined before then.
' For ListItems, these ColumnHeaders have already been defined as part
' of the ListView definition done through the designer at design-time.
' We add ColumnHeaders here in code to show how that can be done,
' but they could also be defined in the designer in the scope item
' property pages.
' NOTE: These ColumnHeaders MUST match the ColumnHeaders defined
' in the ListView, otherwise they will not display.
With .ColumnHeaders
.Add 1, KEY_NAME, SZDISPLAY_NAME
.Add 2, KEY_TYPE, SZDISPLAY_TYPE
.Add 3, KEY_TOTALSIZE, SZDISPLAY_TOTALSIZE
.Add 4, KEY_FREESPACE, SZDISPLAY_FREESPACE
End With ' .ColumnHeaders
' This is where we add the actual data that will be displayed in the
' in the ResultView for these nodes when the user selects detail view.
With .ListSubItems
.Add 1, KEY_NAME, szDisplay ' Column "Name"
.Add 2, KEY_TYPE, szType ' Column "Type"
If Drive.IsReady Then
.Add 3, KEY_TOTALSIZE, Format(Drive.TotalSize, SIZE_FORMAT_SPECIFIER) ' Column "Total Size"
.Add 4, KEY_FREESPACE, Format(Drive.FreeSpace, SIZE_FORMAT_SPECIFIER) ' Column "Free Space"
Else
.Add 3, KEY_TOTALSIZE, "0" ' Column "Total Size"
.Add 4, KEY_FREESPACE, "0" ' Column "Free Space"
End If
End With ' .ListSubItems
End With ' .DriveScopeItem
End If ' Drive.DriveType <> Remote
Next Drive
' At this point the array of drive names is complete and can be exported
With ScopeItems(SZ_MYCOMPUTER)
.Data.SetData szDriveNames, "DriveNames"
' Enable the DriveStats dynamic extension for the MyComputer scope item.
.DynamicExtensions("{8A7A7E11-A8AC-11D2-97E5-00104B880587}").NameSpaceEnabled = True
End With
Exit Sub
' Error Handler for this method
ErrTrap_AddDrivesToScope:
DisplayError "AddDrivesToScope"
End Sub
' =============================================================================
' Method: AddFilesToView
' Type: Subroutine
' Description: Enumerate all the files located within the specified folder
' Parameters: Folder A FileSystemObject object encapsulating a
' directory folder to use for the enumeration
' ResultView A reference to the specific ResultView object
' being activated
' Output: None
' Notes: This method is called as part of the processing for
' the ResultViews_Initialize event, when the user has selected
' a drive or directory in the scope pane.
' We use the Folder object to provide the list of files
' available, and we create a new ListItem for each one.
' =============================================================================
'
Private Sub AddFilesToView(Folder As Scripting.Folder, _
ResultView As SnapInLib.ResultView)
On Error GoTo ErrTrap_AddFilesToView
Dim Files As Scripting.Files ' collection of files from within a folder
Dim File As Scripting.File ' reference to each file in the Files collection
' From the folder, get the Files collection...
Set Files = Folder.Files
' Create each of the list items and all of their list sub-items.
With ResultView.ListView
For Each File In Files
AddNewFile .ListItems, File
Next File
End With
Exit Sub
' Error Handler for this method
ErrTrap_AddFilesToView:
DisplayError "AddFilesToView"
End Sub
' =============================================================================
' Method: AddNewFile
' Type: Subroutine
' Description: Add a list item for a file
' data
' Parameters: ListItems The MMCListItems object belonging to the
' ResultView.ListView being populated
' File The FileSystemObject object representing the file
'
' Output: None
' Notes: This method adds a new list item to the list view, sets the
' text for each of the list subitems used in the detail view, and
' sets the data exported for use by extension snap-ins.
' =============================================================================
'
Private Sub AddNewFile(ListItems As MMCListItems, File As Scripting.File)
On Error GoTo ErrTrap_AddNewFile
Dim ListItem As MMCListItem ' reference to the newly added ListItem
' Check whether the file name matches the current filtering criteria.
If Not FileMatchesFilter(File.Name) Then
Exit Sub
End If
' The ListItems.Add call will add a new row entry
' .ListItems.Add(, ' omit index to append to the collection
' File.Path ' The key value, using the full pathname
' File.Name ' The display text for the item when not in
' ' in detail view
' KEY_FILE ' The index of the image to use
Set ListItem = ListItems.Add(, File.Path, File.Name, KEY_FILE)
' Set the subitem text
InitListItem ListItem, File
' Set the exported data
InitListItemData ListItem, File
Exit Sub
' Error Handler for this method
ErrTrap_AddNewFile:
DisplayError "AddNewFile"
End Sub
' =============================================================================
' Method: FileMatchesFilter
' Type: Subroutine
' Description: Check the file name against the current filtering criteria
'
' Parameters: FQFileName Fully qualified file name (drive + path + name)
' Output: True - file matches current filter
' False - file does not match current filter
' Notes: On MMC 1.1 or when the user disables filtering on MMC 1.2 the
' filter value will be * which means that everything matches.
' =============================================================================
'
Private Function FileMatchesFilter(FQFileName As String)
Dim BaseName As String ' file name without path prefix
Dim FileName As String ' file name portion before the last dot
Dim FileExt As String ' file name portion after the last dot
Dim DotPos As Integer ' position of dot in file name
On Error GoTo ErrTrap_FileMatchesFilter
' We don 't really support a value of *.* but users are likely to type it in so
' treat it the same as *
If (m_FilterValue = "*") Or (m_FilterValue = "*.*") Then
FileMatchesFilter = True
Exit Function
End If
' Get file name without the path
BaseName = FQFileName
' Get the position of the last dot in the file name
DotPos = InStrRev(BaseName, ".", , vbTextCompare)
' Get the file name and extension
If DotPos <> 0 Then
FileName = Left(BaseName, DotPos - 1)
FileExt = Right(BaseName, Len(BaseName) - DotPos)
End If
' Apply filter
If m_FilterByName Then
If DotPos = 0 Then ' no dot, name must match as is
If StrComp(BaseName, m_FilterValue, vbTextCompare) <> 0 Then
FileMatchesFilter = False
Else
FileMatchesFilter = True
End If
Else ' dot found, check name before dot against filter
If StrComp(FileName, m_FilterValue, vbTextCompare) <> 0 Then
FileMatchesFilter = False
Else
FileMatchesFilter = True
End If
End If
Else ' filtering by extension
If DotPos = 0 Then ' no dot, not a match because file has no extension
FileMatchesFilter = False
Else ' dot found, check name after dot against filter
If StrComp(FileExt, m_FilterValue, vbTextCompare) <> 0 Then
FileMatchesFilter = False
Else
FileMatchesFilter = True
End If
End If
End If
Exit Function
' Error Handler for this method
ErrTrap_FileMatchesFilter:
DisplayError "FileMatchesFilter"
End Function
' =============================================================================
' Method: InitListItem
' Type: Subroutine
' Description: Set the list subitems for a new list item
' data
' Parameters: ListItem The MMCListItem object to be initialized
' File The FileSystemObject object for the file
' represented by the list item.
' Output: None
' Notes: This method adds the list subitems to a new list item and sets
' their text according to the column definitions. It also sets
' ListItem.Tag to the File object.
' =============================================================================
'
Private Sub InitListItem(ListItem As MMCListItem, File As Scripting.File)
On Error GoTo ErrTrap_InitListItem
Dim szAttributes As String ' display string to use to build file attributes
Dim Index As String
' ListSubItems.Add will add the text to be displayed in all the columns of
' the ListView when shown in Report mode. First clear the subitems
' collection in case this method is being called due to a rename operation.
Index = CStr(ListItem.Index)
With ListItem.ListSubItems
.Clear
.Add 1, KEY_NAME & Index, File.Name
.Add 2, KEY_SIZE & Index, Format(File.Size, SIZE_FORMAT_SPECIFIER)
.Add 3, KEY_DATE & Index, Format(File.DateLastModified, DATE_FORMAT_SPECIFIER)
' Attributes is stored as a bitfield, so translate it
' into a readable string
szAttributes = ""
If File.Attributes And ReadOnly Then szAttributes = "R"
If File.Attributes And Archive Then szAttributes = szAttributes & "A"
If File.Attributes And System Then szAttributes = szAttributes & "S"
If File.Attributes And Hidden Then szAttributes = szAttributes & "H"
.Add 4, KEY_ATTRIBUTES & Index, szAttributes
End With
' In order to display properties for the item we'll need the File
' object so put into MMCListItem.Tag
Set ListItem.Tag = File
Exit Sub
' Error Handler for this method
ErrTrap_InitListItem:
DisplayError "InitListItem"
End Sub
' =============================================================================
' Method: InitListItemData
' Type: Subroutine
' Description: Set the exported data for a new list item
' data
' Parameters: ListItem The MMCListItem object to be initialized
' File The FileSystemObject object for the file
' represented by the list item.
' Output: None
' Notes: This method stores the exported data in ListItem.Data to be
' used by extension snap-ins. It the file is a DLL then the
' ComDetect sample dynamic extension is enabled. This allows
' ComDetect to add an item to the Task context menu for this
' file allowing the user to query whether the DLL is a COM server.
' =============================================================================
'
Private Sub InitListItemData(ListItem As MMCListItem, File As Scripting.File)
On Error GoTo ErrTrap_InitListItemData
' Set exported data:
'The 1st format is called "File". The data is the file name without the path
ListItem.Data.SetData File.Name, "File"
'The 2nd format is called "Path". The data is the fully qualified file name
ListItem.Data.SetData File.Path, "Path"
' If this file is a DLL then enable the dynamic extension ComDetect.
' We must use the CLSID as the key because node type names are not required
' by MMC in the registry and even if present, they may not be unique.
If Len(File.Name) > 4 Then
If InStr(1, Right$(File.Name, 4), ".DLL", vbTextCompare) <> 0 Then
ListItem.DynamicExtensions("{EB882E49-CDD4-11D2-97ED-00104B880587}").Enabled = True
End If
End If
Exit Sub
' Error Handler for this method
ErrTrap_InitListItemData:
DisplayError "InitListItemData"
End Sub
' =============================================================================
' Method: AddFoldersToScope
' Type: Subroutine
' Description: Enumerate all the folders located under the specified folder
' (represented by the ParentScopeItem.Key value) using the
' FileSystemObject
' Parameters: ParentScopeItem The ScopeItem under whose ScopeNode to insert
' the new nodes being added
' Output: None
' Notes: This method is called to support the processing taking place
' during ScopeItems_Expand.
' =============================================================================
'
Private Sub AddFoldersToScope(ParentScopeItem As ScopeItem)
On Error GoTo ErrTrap_AddFoldersToScope
Dim ParentFolder As Scripting.Folder
Dim SubFolder As Scripting.Folder
Dim Folders As Scripting.Folders
' Make sure that this drive is available to be queried
If m_FileSystemObject.GetDrive(m_FileSystemObject.GetDriveName(ParentScopeItem.Key)).IsReady Then
' Get a reference to the actual folder represented by the
Set ParentFolder = m_FileSystemObject.GetFolder(ParentScopeItem.Key)
' Get the folders collection containing the subdirectories of this folder...
Set Folders = ParentFolder.SubFolders
'...and iterate through the list
For Each SubFolder In Folders
AddNewFolder ParentScopeItem, SubFolder
Next SubFolder
End If
Exit Sub
' Error Handler for this method
ErrTrap_AddFoldersToScope:
DisplayError "AddFoldersToScope"
End Sub
' =============================================================================
' Method: AddNewFolder
' Type: Subroutine
' Description: Add a new ScopeItem representing the specified SubFolder and
' initialize it
'
' Parameters: ParentScopeItem The ScopeItem under whose ScopeNode to insert
' the new nodes being added
' Output: None
' Notes: This method is called to support the processing taking place
' during ScopeItems_Expand.
' =============================================================================
'
Private Sub AddNewFolder(ParentScopeItem As ScopeItem, _
SubFolder As Scripting.Folder)
On Error GoTo ErrTrap_AddNewFolder
Dim FolderScopeItem As ScopeItem
' There is only one global ScopeItems collection, and it is
' a property of the snap-in itself. As such, it is globally
' available to be referenced.
Set FolderScopeItem = ScopeItems.AddPreDefined(SZ_DIRECTORY, _
SubFolder.Path, _
ParentScopeItem.ScopeNode, _
siParent)
' Set the NodeID to the path as that is a unique non-localized string that can
' identify the node in the scope pane. Set SlowRetrieval to False so that
' when a console file is reloaded the same scope node will be selected.
FolderScopeItem.NodeID = SubFolder.Path
FolderScopeItem.SlowRetrieval = False
' Set exported data: Format is "Folder", data is folder path
FolderScopeItem.Data.SetData SubFolder.Path, "Folder"
' We have to separately set the displayed text for this new ScopeItem
FolderScopeItem.ScopeNode.DisplayName = SubFolder.Name
' Store the fully qualified pathname as the key of the newly created node
FolderScopeItem.Key = SubFolder.Path
' Set the image key
FolderScopeItem.Folder = KEY_FOLDER
' Set the Folder object in the tag so we can display properties for
' the directory
Set FolderScopeItem.Tag = SubFolder
' ColumnHeader objects define each of the columns shown in a ListView
' when the view mode is set to Report. ListSubItems CAN'T be added to
' a ListView unless there have been ColumnHeaders defined before then.
' For ListItems, these ColumnHeaders have already been defined as part
' of the ListView definition done through the designer at design-time.
' We add ColumnHeaders here in code to show how that can be done,
' but they could also be defined in the designer in the scope item
' property pages.
' NOTE: These ColumnHeaders MUST match the ColumnHeaders defined
' in the ListView, otherwise they will not display.
With FolderScopeItem.ColumnHeaders
.Add 1, KEY_NAME, SZDISPLAY_NAME
.Add 2, KEY_SIZE, SZDISPLAY_SIZE
.Add 3, KEY_DATE, SZDISPLAY_DATE
.Add 4, KEY_ATTRIBUTES, SZDISPLAY_ATTRIBUTES
End With
' This is where we add the actual data that will be displayed in the
' in the ResultView for these nodes.
With FolderScopeItem.ListSubItems
.Add 1, KEY_NAME, SubFolder.Name ' Column "Name"
.Add 2, KEY_SIZE, "" ' Column "Size", not used for folders
.Add 3, KEY_DATE, Format(SubFolder.DateLastModified, DATE_FORMAT_SPECIFIER)
' Column "Date"
.Add 4, KEY_ATTRIBUTES, "" ' Column "Attributes", not used for folders
End With
Exit Sub
' Error Handler for this method
ErrTrap_AddNewFolder:
DisplayError "AddNewFolder"
End Sub
' =============================================================================
' Method: DisplayError
' Type: Subroutine
' Description: A method to format and display a runtime error
' Parameters: szLocation A string identifying the source location
' (i.e. method name) where the error occurred
' Output: None
' Notes: The error will be displayed in a messagebox formatted as the
' following sample:
'
' Method: SomeMethodName
' Source: MMCListSubItems
' Error: 2527h (9511)
' Description: There is already an item in the collection that has the specified key
'
' =============================================================================
'
Private Sub DisplayError(szLocation As String)
ConsoleMsgBox "Method:" & vbTab & vbTab & szLocation & vbCrLf _
& "Source:" & vbTab & vbTab & Err.Source & vbCrLf _
& "Error:" & vbTab & vbTab & Hex(Err.Number) & "h (" & CStr(Err.Number) & ")" & vbCrLf _
& "Description:" & vbTab & Err.Description, _
vbCritical, SZ_ERRTITLE
End Sub
' =============================================================================
' Method: FormatByteCount
' Type: Function
' Description: A function to format a byte count as a string for display
' Parameters: nCount Value to be rounded and formatted
' Output: String A formatted, punctuated numeric string
' Notes: This function will first determine the appropriate suffix
' for the value size (i.e. GB, MB, etc.). It will then round
' the value and format it, with comma and appropriate suffix
' =============================================================================
'
Private Function FormatByteCount(nCount As Double) As String
On Error GoTo ErrTrap_FormatByteCount
If nCount >= GIGABYTE Then
FormatByteCount = Format(nCount / GIGABYTE, GIGA_FORMAT_SPECIFIER)
ElseIf nCount >= MEGABYTE And nCount < GIGABYTE Then
FormatByteCount = Format(nCount / MEGABYTE, MEGA_FORMAT_SPECIFIER)
ElseIf nCount >= KILOBYTE And nCount < MEGABYTE Then
FormatByteCount = Format(nCount / KILOBYTE, KILO_FORMAT_SPECIFIER)
Else
FormatByteCount = Format(nCount, BYTE_FORMAT_SPECIFIER)
End If
Exit Function
' Error Handler for this method
ErrTrap_FormatByteCount:
DisplayError "FormatByteCount"
End Function
' =============================================================================
' Method: LaunchFile
' Type: Subroutine
' Description: A method to start a program, either by starting an executable
' directly or by "executing" a well-known extension, whose
' association is recorded in the registry
' Parameters: FileName A string containing a fully qualified pathname
' Output: None
' Notes: This method utilizes the ShellExecute API. Telling ShellExecute
' to "Open" the file is the same as double-clicking on a file
' listing in the Windows Explorer. If the specified file is an
' application, it will be launched directly. If it is a data file
' and its extension is associated with an application in the
' registry, that application will be launched and loaded with
' this file. Otherwise, this call will fail.
' =============================================================================
'
Private Sub LaunchFile(szFileName As String)
On Error GoTo ErrTrap_LaunchFile
Dim handle As Long
Dim szErrString As Long
handle = ShellExecute(0, "Open", szFileName, 0, 0, SW_SHOWNORMAL)
' Check for failure and report it
If handle <= 32 Then
' NOTE: Ordinarily, these strings should be stored in a string table as part
' of a resource file attached to this project. This would allow for a
' single place manage all literal strings, as well as allow for
' easy localization for international versions. For the purposes of
' simplicity, however, the strings have been placed here directly.
Select Case handle
Case ERROR_FILE_NOT_FOUND
szErrString = "The specified file was not found."
Case ERROR_PATH_NOT_FOUND
szErrString = "The specified path was not found."
Case ERROR_BAD_FORMAT
szErrString = "The .exe file is invalid (non-Win32® .exe or error in .exe image)."
Case SE_ERR_ACCESSDENIED
szErrString = "The operating system denied access to the specified file."
Case SE_ERR_ASSOCINCOMPLETE
szErrString = "The file name association is incomplete or invalid."
Case SE_ERR_DDEBUSY
szErrString = "The DDE transaction could not be completed because other DDE transactions were being processed."
Case SE_ERR_DDEFAIL
szErrString = "The DDE transaction failed."
Case SE_ERR_DDETIMEOUT
szErrString = "The DDE transaction could not be completed because the request timed out."
Case SE_ERR_DLLNOTFOUND
szErrString = "The specified dynamic-link library was not found."
Case SE_ERR_FNF
szErrString = "The specified file was not found."
Case SE_ERR_NOASSOC
szErrString = "There is no application associated with the given file name extension."
Case SE_ERR_OOM
szErrString = "There was not enough memory to complete the operation."
Case SE_ERR_PNF
szErrString = "The specified path was not found."
Case SE_ERR_SHARE
szErrString = "A sharing violation occurred"
End Select
ConsoleMsgBox szErrString, vbExclamation, SZ_ERRSHELLEXEC
End If ' handle <= 32
Exit Sub
' Error Handler for this method
ErrTrap_LaunchFile:
DisplayError "LaunchFile"
End Sub
' =============================================================================
' Method: LaunchFiles
' Type: Subroutine
' Description: Calls LaunchFile for each file in the specified ListItems
' collection.
' Parameters: ListItems An MMCListItems collection.
' Output: None
' Notes: None
' =============================================================================
'
Private Sub LaunchFiles(ListItems As MMCListItems)
On Error GoTo ErrTrap_LaunchFiles
Dim ListItem As MMCListItem
For Each ListItem In ListItems
LaunchFile ListItem.Key
Next ListItem
Exit Sub
' Error Handler for this method
ErrTrap_LaunchFiles:
DisplayError "LaunchFiles"
End Sub
' =============================================================================
' Method: LaunchFileRunAs
' Type: Subroutine
' Description: A method to start a program. This method will present a dialog
' box to allow the user to modify the command line before it
' is executed
' Parameters: FileName A string containing a fully qualified pathname
' Output: None
' Notes: In this method we use the Shell command rather than the
' ShellExecute. This is because the ShellExecute API does not
' search through the PATH string, but here we want the RunAs
' behavior to mimic a CommandPrompt
' =============================================================================
'
Private Sub LaunchFileRunAs(szFileName As String)
On Error GoTo ErrTrap_LaunchFileRunAs
Dim szCommandLine As String
' Bring the dialog form into memory
Load frmRunAs
' Prep the edit field for presentation to the user
frmRunAs.txtCmdLine = szFileName
' Display the form as a Modal dialog. This is necessary since we
' cannot display modeless dialogs while running as a snap-in.
frmRunAs.Show vbModal
' Check to see if there is a command line to execute
If frmRunAs.txtCmdLine.Text <> "" Then
' The shell command will return a taskID upon successful
' completion. At this point, we don't really care what happens
' to the process we're launching, so we're not assigning
' the return value to anything.
Shell frmRunAs.txtCmdLine, vbNormalFocus
End If
' Dump the form from memory
Unload frmRunAs
Exit Sub
' Error Handler for this method
ErrTrap_LaunchFileRunAs:
DisplayError "LaunchFileRunAs"
End Sub
' =============================================================================
' Method: LaunchFilesRunAs
' Type: Subroutine
' Description: Calls LaunchFileRunAs for each file in the specified ListItems
' collection.
' Parameters: ListItems An MMCListItems collection.
' Output: None
' Notes: None
' =============================================================================
'
Private Sub LaunchFilesRunAs(ListItems As MMCListItems)
On Error GoTo ErrTrap_LaunchFilesRunAs
Dim ListItem As MMCListItem
For Each ListItem In ListItems
LaunchFileRunAs ListItem.Key
Next ListItem
Exit Sub
' Error Handler for this method
ErrTrap_LaunchFilesRunAs:
DisplayError "LaunchFilesRunAs"
End Sub
' =============================================================================
' Method: GetBaseName
' Type: Function
' Description: Returns the base name extracted from a fully qualified file path.
'
' Parameters: Path Fully qualified path name
' varLastBackSlashPos Optional. If present then 1 based index of
' last backslash is returned here
' Output: Base name of file
' Notes: Example: If path is "c:\winnt\system32\event.log" the returned
' string is "event.log"
' =============================================================================
'
Private Function GetBaseName(ByVal Path As String, _
ByRef varLastBackSlashPos As Variant) As String
On Error GoTo ErrTrap_GetBaseName
' Search from the last character of the string for the last occurrence of '\'
Dim iLastBackSlashPos As Integer
iLastBackSlashPos = InStrRev(Path, "\", -1, vbTextCompare)
If iLastBackSlashPos = 0 Then
Err.Raise vbObjectError + 513, _
"FileExplorer", "Could not find last backslash in path " & Path
End If
'Extract the file name from the right side of the path
GetBaseName = Right$(Path, Len(Path) - iLastBackSlashPos)
' If requested, return the position of the last backslash
If Not IsMissing(varLastBackSlashPos) Then
varLastBackSlashPos = iLastBackSlashPos
End If
Exit Function
' Error Handler for this method
ErrTrap_GetBaseName:
DisplayError "GetBaseName"
End Function
' =============================================================================
' Method: Rename
' Type: Function
' Description: Replaces the file name within a fully qualified path
'
' Parameters: OldPath Fully qualified path name
' NewName New file name
'
' Output: New fully qualified path with file name replaced.
' Notes: Example: If OldPath is "c:\winnt\system32\event.log" and
' NewName is "event.txt", returns "c:\winnt\system32\event.txt"
' =============================================================================
'
Private Function Rename(OldPath As String, NewName As String) As String
On Error GoTo ErrTrap_Rename
Dim LastBackSlashPos As Integer
Dim OldName As String
' Build the new complete path
' Get the old file name from the old path
OldName = GetBaseName(OldPath, LastBackSlashPos)
Rename = Left$(OldPath, LastBackSlashPos) & NewName
Exit Function
' Error Handler for this method
ErrTrap_Rename:
DisplayError "Rename"
End Function
' =============================================================================
' Method: CreateNewDirectory
' Type: Subroutine
' Description: Creates a new directory in the file system and adds a new
' scope item for it
'
' Parameters: ParentScopeItem ScopeItem of parent directory in which to
' create the new directory
'
' Output: None
' Notes: Creates a new directory under the specified parent using the
' name "New Folder". If that name exists then searches for an
' unused name by appending digits e.g. "New Folder (1)".
' If the parent scope item has not yet been expanded in the
' namespace then that is done so that the scope item for the new
' folder may be added at this time.
' =============================================================================
'
Private Sub CreateNewDirectory(ParentScopeItem As SnapInLib.ScopeItem)
On Error GoTo ErrTrap_CreateNewDirectory
Dim Drive As Scripting.Drive
Dim Folder As Scripting.Folder
Dim NewFolder As Scripting.Folder
Dim NewFolderName As String
Dim Digit As Integer
If TypeOf ParentScopeItem.Tag Is Scripting.Drive Then
Set Drive = ParentScopeItem.Tag
Set Folder = Drive.RootFolder
Else
Set Folder = ParentScopeItem.Tag
End If
' Find a unique name for the new folder. Try "New Folder". If that is used then try
' "New Folder(1)", "New Folder (2)", etc.
NewFolderName = Folder.Path & "\New Folder"
Digit = 0
While m_FileSystemObject.FolderExists(NewFolderName)
Digit = Digit + 1
NewFolderName = Folder.Path & "\New Folder (" & LTrim$(Str$(Digit)) & ")"
Wend
' Create the new folder
Set NewFolder = m_FileSystemObject.CreateFolder(NewFolderName)
' Add a new scope item for the sub-directory. If the parent hasn't yet been expanded
' then do it now and the scope item will be added. If it has already been expanded
' then add the new scope item.
If Not ParentScopeItem.ScopeNode.ExpandedOnce Then
ParentScopeItem.ScopeNode.ExpandInNameSpace
Else
AddNewFolder ParentScopeItem, NewFolder
End If
Exit Sub
' Error Handler for this method
ErrTrap_CreateNewDirectory:
DisplayError "CreateNewDirectory"
End Sub
' =============================================================================
' Method: ProcessUICommand
' Type: Subroutine
' Description: Processes user input from toolbar, menu button, and context menus.
'
' Parameters: Selection MMCClipboard object containing the current selected
' items. The selection may be in either the scope pane
' or in the result pane.
' Command String containing key of command to execute (KEY_ADD,
' KEY_RUN, or KEY_RUNAS).
'
' Output: None
' Notes: For KEY_ADD creates a new directory under the selected directory
' For KEY_RUN calls LaunchFiles for the selected files
' For KEY_RUNAS calls LaunchFilesRunAs for the selected files
' =============================================================================
'
Private Sub ProcessUICommand(ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Command As String)
On Error GoTo ErrTrap_ProcessUICommand
Dim RootScopeItem As ScopeItem
Dim SelectionType As SnapInSelectionTypeConstants
SelectionType = Selection.SelectionType
Select Case Command
Case KEY_ADD
If SelectionType = siSingleScopeItem Then
CreateNewDirectory Selection.ScopeItems(1)
End If
Case KEY_RUN
If (SelectionType = siSingleListItem) Or (SelectionType = siMultiListItems) Then
' Launch the requested files, using the LaunchFile utility method
LaunchFiles Selection.ListItems
End If
Case KEY_RUNAS
If (SelectionType = siSingleListItem) Or (SelectionType = siMultiListItems) Then
' Launch the requested files, using the LaunchFileRunAs utility method
LaunchFilesRunAs Selection.ListItems
End If
Case KEY_CONFIGURATION
' Get the root scope item of the snap-in
On Error Resume Next
Set RootScopeItem = ScopeItems(SZ_STATICNODE)
On Error GoTo ErrTrap_ProcessUICommand
If RootScopeItem Is Nothing Then
Set RootScopeItem = ScopeItems(SZ_EXTENSION_ROOT)
End If
' Create a property sheet with the configuration wizard. This is the same
' wizard that is displayed when FileExplorer is added to a console.
With Views.CurrentView.PropertySheetProvider
' Create the property sheet as a wizard.
.CreatePropertySheet "FileExplorer Configuration Wizard", siWizard, RootScopeItem
' Tell MMC to add the pages for the primary snap-in. This will fire
' Views_QueryPagesFor and Views_CreatePropertyPages
.AddPrimaryPages True
' Tell MMC to show the property sheet starting with the 1st page
.Show 1
' Call the SnapIn_ConfigurationComplete event handler as it
' knows what to do after running the wizard.
SnapIn_ConfigurationComplete m_ConfigData
End With
Case Else
' This should not occur. If it does, it is because the
' toolbar, menu button, or context menus have been modified and
' this select statement has not been updated to deal with it.
' This will catch the developer's attention without causing problems
' for any unwary end users.
Debug.Assert False
End Select
Exit Sub
' Error Handler for this method
ErrTrap_ProcessUICommand:
DisplayError "ProcessUICommand"
End Sub
' =============================================================================
' Method: ConfirmOverwrite
' Type: Function
' Description: Displays a message box asking the user whether to overwrite
' an existing file.
'
' Parameters: Path Fully qualified path of file that will be overwritten
'
' Output: True if user indicated it is OK to overwrite, otherwise False
' Notes: None
' =============================================================================
'
Private Function ConfirmOverwrite(Path As String) As Boolean
On Error GoTo ErrTrap_ConfirmOverwrite
Dim Choice As Integer
Choice = ConsoleMsgBox(Path & " exists." & vbCrLf & _
"Do you wish to overwrite?", _
vbYesNo, "FileExplorer")
If Choice = vbYes Then
ConfirmOverwrite = True
Else
ConfirmOverwrite = False
End If
Exit Function
' Error Handler for this method
ErrTrap_ConfirmOverwrite:
DisplayError "ConfirmOverwrite"
End Function
' =============================================================================
' Method: SetUpFilter
' Type: Subroutine
' Description: Initializes column header filters
'
' Parameters: ResultView ResultView being initialized
'
' Output: None
' Notes: We only support filtering on the file name so all other columns
' are set to a zero length empty string filter to prevent the user from
' typing in a value
'
' =============================================================================
'
Private Sub SetUpFilter(ResultView As SnapInLib.ResultView)
On Error GoTo ErrTrap_SetUpFilter
m_FilterValue = "*"
m_FilterByName = False
m_FilterByExt = True
With ResultView.ListView
.ColumnHeaders(KEY_NAME).TextFilter = "*"
.ColumnHeaders(KEY_NAME).TextFilterMaxLen = 256
.ColumnHeaders(KEY_SIZE).TextFilter = ""
.ColumnHeaders(KEY_SIZE).TextFilterMaxLen = 0
.ColumnHeaders(KEY_DATE).TextFilter = ""
.ColumnHeaders(KEY_DATE).TextFilterMaxLen = 0
.ColumnHeaders(KEY_ATTRIBUTES).TextFilter = ""
.ColumnHeaders(KEY_ATTRIBUTES).TextFilterMaxLen = 0
End With
Exit Sub
' Error Handler for this method
ErrTrap_SetUpFilter:
DisplayError "SetUpFilter"
End Sub
' =============================================================================
' Method: ExtensionSnapIn_Expand
' Type: Event
' Description: Called when this snap-in is added as a namespace extension of
' Computer Management\System Tools on Windows 2000.
'
' Parameters: Data MMCDataObject containing the data exported by the
' parent node of the snap-in we are extending
' ScopeNode Represents the parent node
'
' Output: None
' Notes: The actual data exported by the System Tools node is not
' important so we do not examine it. We double check the parent
' node's node type GUID but in theory this is not necessary as
' this event would only be fired when the System Tools node is
' expanding as that it the only node type we extend. When extending
' multiple node types that check would be essential. We add our
' ExtensionRoot predefined node underneath the parent. This node
' is a carbon copy of our static node.
' =============================================================================
'
Private Sub ExtensionSnapIn_Expand(ByVal Data As SnapInLib.IMMCDataObject, _
ByVal ScopeNode As SnapInLib.IScopeNode)
On Error GoTo ErrTrap_ExtensionSnapIn_Expand
Dim MachineName As String
Dim ExtensionRoot As ScopeItem
' If the expanding node is Computer Management\System Tools then add our
' extension root underneath it.
If ScopeNode.NodeTypeGUID = "{476e6448-aaff-11d0-b944-00c04fd8d5b0}" Then
On Error Resume Next
MachineName = FormatData(Data.GetData("MMC_SNAPIN_MACHINE_NAME", 512), 1, siString)
On Error GoTo ErrTrap_ExtensionSnapIn_Expand
If MachineName = "" Then
MachineName = "Local Machine"
End If
Set ExtensionRoot = ScopeItems.AddPreDefined(SZ_EXTENSION_ROOT, _
SZ_EXTENSION_ROOT, _
ScopeNode, siParent)
ExtensionRoot.ScopeNode.DisplayName = "FileExplorer for " & MachineName
End If
Exit Sub
' Error Handler for this method
ErrTrap_ExtensionSnapIn_Expand:
DisplayError "ExtensionSnapIn_Expand"
End Sub
' =============================================================================
' Method: mnuNewFolder_Click
' Type: Event
' Description: Called when the "Folder" item on the "New" context menu is clicked
'
'
' Parameters: Index This will always be 1 as we are directly handling
' the event on the individual menu item rather than
' the event on its parent.
' Selection MMCClipboard object containing the currently selected
' items. The selection may be in either the scope pane
' or in the result pane.
'
' Output: None
' Notes: Calls ProcessUICommand to do the work.
' =============================================================================
'
Private Sub mnuNewFolder_Click(ByVal Index As Long, _
ByVal Selection As SnapInLib.IMMCClipboard)
On Error GoTo ErrTrap_mnuNewFolder_Click
ProcessUICommand Selection, KEY_ADD
Exit Sub
' Error Handler for this method
ErrTrap_mnuNewFolder_Click:
DisplayError "mnuNewFolder_Click"
End Sub
' =============================================================================
' Method: mnuRun_Click
' Type: Event
' Description: Called when the "Run" item on the context menu is clicked
'
'
' Parameters: Index This will always be 1 as we are directly handling
' the event on the individual menu item rather than
' the event on its parent.
' Selection MMCClipboard object containing the currently selected
' items. The selection may be in either the scope pane
' or in the result pane.
'
' Output: None
' Notes: Calls ProcessUICommand to do the work.
' =============================================================================
'
Private Sub mnuRun_Click(ByVal Index As Long, _
ByVal Selection As SnapInLib.IMMCClipboard)
On Error GoTo ErrTrap_mnuRun_Click
ProcessUICommand Selection, KEY_RUN
Exit Sub
' Error Handler for this method
ErrTrap_mnuRun_Click:
DisplayError "mnuRun_Click"
End Sub
' =============================================================================
' Method: mnuRunAs_Click
' Type: Event
' Description: Called when the "Run As..." item on the context menu is clicked
'
'
' Parameters: Index This will always be 1 as we are directly handling
' the event on the individual menu item rather than
' the event on its parent.
' Selection MMCClipboard object containing the currently selected
' items. The selection may be in either the scope pane
' or in the result pane.
'
' Output: None
' Notes: Calls ProcessUICommand to do the work.
' =============================================================================
'
Private Sub mnuRunAs_Click(ByVal Index As Long, _
ByVal Selection As SnapInLib.IMMCClipboard)
On Error GoTo ErrTrap_mnuRunAs_Click
ProcessUICommand Selection, KEY_RUNAS
Exit Sub
' Error Handler for this method
ErrTrap_mnuRunAs_Click:
DisplayError "mnuRunAs_Click"
End Sub
' =============================================================================
' Method: FilterResultPane
' Type: Subroutine
' Description: Filters the contents of the list view in the result pane
' Parameters: ResultView The ResultView to be filtered
' Output: None
' Notes: See ResultViews_FilterButtonClick for an explanation of how the
' filter operator is applied.
' =============================================================================
Private Sub FilterResultPane(ResultView As SnapInLib.ResultView)
On Error GoTo ErrTrap_FilterResultPane
Dim Folder As Scripting.Folder
Dim Drive As Scripting.Drive
With ResultView.ScopePaneItem.ScopeItem
' Get the folder of the currently selected scope item in the scope pane
Set Folder = Nothing
If TypeOf .Tag Is Scripting.Folder Then
Set Folder = .Tag
ElseIf TypeOf .Tag Is Scripting.Drive Then
Set Drive = .Tag
If Drive.IsReady Then
Set Folder = Drive.RootFolder
End If
End If
If Folder Is Nothing Then
Exit Sub
End If
' Remove all the files from the result pane
ResultView.ListView.ListItems.Clear
' Re-add all of the files. AddFilesToView will filter out files that do not
' apply
AddFilesToView Folder, ResultView
End With
Exit Sub
' Error Handler for this method
ErrTrap_FilterResultPane:
DisplayError "FilterResultPane"
End Sub
' =============================================================================
' Method: mnuURL_Click
' Type: Event
' Description: Called when the "URL..." item is clicked on the "New" submenu
' for the Internet Explorer node
'
' Parameters: Index This will always be 1 as we are directly handling
' the event on the individual menu item rather than
' the event on its parent.
' Selection MMCClipboard object containing the currently selected
' items. The selection may be in either the scope pane
' or in the result pane.
'
' Output: None
' Notes: Display the property sheet for the Internet Explorer node.
' =============================================================================
'
Private Sub mnuURL_Click(ByVal Index As Long, _
ByVal Selection As SnapInLib.MMCClipboard)
On Error GoTo ErrTrap_mnuURL_Click
' Display the property sheet for the Internet Explorer node programmatically.
With CurrentView.PropertySheetProvider
.CreatePropertySheet "Internet Explorer", siPropertySheet, _
ScopeItems(SZ_INTERNETEXPLORER), True, True
' Check if the Internet Explorer scope item is selected in the scope pane
If CurrentScopePaneItem.Key = SZ_INTERNETEXPLORER Then
.AddPrimaryPages True
Else
.AddPrimaryPages False
End If
.Show 1
End With
Exit Sub
' Error Handler for this method
ErrTrap_mnuURL_Click:
DisplayError "mnuURL_Click"
End Sub
' =============================================================================
' Method: ResultViews_Activate
' Type: Event
' Description: Fired when a ResultView is about to be displayed in the result
' pane
' Parameters: ResultView The ResultView being shown
' Output: None
' Notes: We use this event to put a count of the objects in the result
' pane into the description bar. The description bar is like
' a status bar but it appears on top of the result pane. It is
' only displayed if the user makes it visible using the View menu.
' Note that a snap-in cannot write to the description bar during
' ResultViews_Initialize because MMC has not yet created
' the result pane at that point.
' =============================================================================
'
Private Sub ResultViews_Activate(ByVal ResultView As SnapInLib.IResultView)
On Error GoTo ErrTrap_ResultViews_Activate
Dim Drive As Scripting.Drive
Dim Folder As Scripting.Folder
Dim Files As Scripting.Files
Set Folder = Nothing
' If this is the IE Browser Node then display the URL in the status bar
If ResultView.ScopePaneItem.Name = SZ_INTERNETEXPLORER Then
CurrentView.SetStatusBarText ResultView.DisplayString
End If
' Get the folder for which contents are being displayed in the result pane
With ResultView.ScopePaneItem.ScopeItem
If TypeOf .Tag Is Scripting.Folder Then
Set Folder = .Tag
ElseIf TypeOf .Tag Is Scripting.Drive Then
Set Drive = .Tag
If Drive.IsReady Then
Set Folder = Drive.RootFolder
End If
End If
End With
If Folder Is Nothing Then
Exit Sub
End If
' Put the count of all directories and files on the description bar
ResultView.SetDescBarText CStr(Folder.SubFolders.Count + Folder.Files.Count) & " object(s)"
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_Activate:
DisplayError "ResultViews_Activate"
End Sub
' =============================================================================
' Method: ResultViews_CompareItems
' Type: Event
' Description: Fired when populating a sorted listview
' Parameters: ResultView The ResultView being populated
' Object1 First item to compare
' Object2 Second item to compare
' Column The column on which the sort is occurring
' Result Comparison Result returned here
'
' Output: Result 0 if list items are lexically equal
' 1 if item1 is lexcially greater than item 2
' -1 if item1 is lexcially lesser than item 2
' Notes: This event does not need to take into account the sort order as MMC
' will reverse the result as needed depending on the sort order.
' FileExplorer allows sorting on date and size for files and folders, or
' total size and free space for drives.
' Note that there is no code in this handler for the name and attribute
' columns because we use the default sort which is a alphabetical.
' On MMC 1.1, both objects will always be list items. On MMC 1.2
' they could be either scope items or list items.
' =============================================================================
'
Private Sub ResultViews_CompareItems(ByVal ResultView As SnapInLib.ResultView, _
ByVal Object1 As Object, _
ByVal Object2 As Object, _
ByVal Column As Long, _
Result As Variant)
On Error GoTo ErrTrap_ResultViews_CompareItems
Dim ScopeItem1 As ScopeItem
Dim ScopeItem2 As ScopeItem
Dim ListItem1 As MMCListItem
Dim ListItem2 As MMCListItem
Dim Drive1 As Scripting.Drive
Dim Drive2 As Scripting.Drive
Dim Folder1 As Scripting.Folder
Dim Folder2 As Scripting.Folder
Dim File1 As Scripting.File
Dim File2 As Scripting.File
Dim Size1 As Double
Dim Size2 As Double
Dim Date1 As Date
Dim Date2 As Date
Dim fSizeCompare As Boolean
Dim fDateCompare As Boolean
fSizeCompare = False
fDateCompare = False
' Determine whether we have scope items or list items
If TypeOf Object1 Is ScopeItem Then
Set ScopeItem1 = Object1
Else
Set ListItem1 = Object1
End If
If TypeOf Object2 Is ScopeItem Then
Set ScopeItem2 = Object2
Else
Set ListItem2 = Object2
End If
' If we have scope items then determine whether they represent folders or
' drives.
If Not ScopeItem1 Is Nothing Then
If TypeOf ScopeItem1.Tag Is Scripting.Drive Then
Set Drive1 = ScopeItem1.Tag
ElseIf TypeOf ScopeItem1.Tag Is Scripting.Folder Then
Set Folder1 = ScopeItem1.Tag
End If
End If
If Not ScopeItem2 Is Nothing Then
If TypeOf ScopeItem2.Tag Is Scripting.Drive Then
Set Drive2 = ScopeItem2.Tag
ElseIf TypeOf ScopeItem2.Tag Is Scripting.Folder Then
Set Folder2 = ScopeItem2.Tag
End If
End If
' If we have list items then get the file objects
If Not ListItem1 Is Nothing Then
Set File1 = ListItem1.Tag
End If
If Not ListItem2 Is Nothing Then
Set File2 = ListItem2.Tag
End If
' If the request is to compare a folder and a file then return a result indicating that
' the folder is lexcially lesser than the file. This ensures that folders always appear
' together and files appear together, each group sorted among themselves. This is
' similar to the way the Windows Explorer displays folders and files.
If (Not Folder1 Is Nothing) And (Not File2 Is Nothing) Then
Result = -1
Exit Sub
ElseIf (Not File1 Is Nothing) And (Not Folder2 Is Nothing) Then
Result = 1
Exit Sub
End If
' If we have drives then we could be sorting on total size or free space. If it is
' anything else then let the designer runtime do an alphabetical sort.
If Not Drive1 Is Nothing Then
If (Column <> COLNUM_TOTALSIZE) And (Column <> COLNUM_FREESPACE) Then
Exit Sub
End If
fSizeCompare = True
If Column = COLNUM_TOTALSIZE Then
If Drive1.IsReady Then
Size1 = Drive1.TotalSize
Else
Size1 = 0
End If
If Drive2.IsReady Then
Size2 = Drive2.TotalSize
Else
Size2 = 0
End If
ElseIf Column = COLNUM_FREESPACE Then
If Drive1.IsReady Then
Size1 = Drive1.FreeSpace
Else
Size1 = 0
End If
If Drive2.IsReady Then
Size2 = Drive2.FreeSpace
Else
Size2 = 0
End If
End If
Else
' Folders or files. Could be size or date. If it is anything else then let the
' runtime handle it.
If (Column <> COLNUM_SIZE) And (Column <> COLNUM_DATE) Then
Exit Sub
End If
If Column = COLNUM_SIZE Then
fSizeCompare = True
If Not Folder1 Is Nothing Then
Size1 = Folder1.Size
Else
Size1 = File1.Size
End If
If Not Folder2 Is Nothing Then
Size2 = Folder2.Size
Else
Size2 = File2.Size
End If
Else ' COLNUM_DATE
fDateCompare = True
If Not Folder1 Is Nothing Then
Date1 = Folder1.DateLastModified
Else
Date1 = File1.DateLastModified
End If
If Not Folder2 Is Nothing Then
Date2 = Folder2.DateLastModified
Else
Date2 = File2.DateLastModified
End If
End If
End If
' At this point we know whether we are comparing sizes or dates so do the comparison
' and return a result. The result is computed in the same way as the function StrComp.
If fSizeCompare Then
If Size1 = Size2 Then
Result = 0
ElseIf Size1 > Size2 Then
Result = 1
Else
Result = -1
End If
Else
If Date1 = Date2 Then
Result = 0
ElseIf Date1 > Date2 Then
Result = 1
Else
Result = -1
End If
End If
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_CompareItems:
DisplayError "ResultViews_CompareItems"
End Sub
' =============================================================================
' Method: ResultViews_FilterButtonClick
' Type: Event
' Description: Fired when a the user clicks the filter button
' Parameters: ResultView The ResultView in which the click occurred
' Column The column on which the click occurred
' Left, Top The coordinates of the top left corner of
' the column header
' Height, Width The width of the column header
' Output: None
' Notes: The user clicks the filter button in order to change the
' filter operator. The filter operator determines how the snap-in
' interprets the filter value entered into the header control.
' FileExplorer does some very primitive file name filtering as
' an example of this feature. The user can choose to filter by
' file name or extension. For example, if the user filters by
' extension and enters "DLL" for the filter value then FileExplorer
' will display only files that match *.dll. Entering a filter
' value of "*" will display all files (i.e. *.*).
' =============================================================================
'
Private Sub ResultViews_FilterButtonClick(ByVal ResultView As SnapInLib.ResultView, _
ByVal Column As SnapInLib.MMCColumnHeader, _
ByVal Left As Long, _
ByVal Top As Long, _
ByVal Height As Long, _
ByVal Width As Long)
On Error GoTo ErrTrap_ResultViews_FilterButtonClick
' If this is not the name column then ignore it
If Column.Key <> KEY_NAME Then
Exit Sub
End If
' Update the filter value
m_FilterValue = Column.TextFilter
' Display the filter operator popup menu. If the user makes a selection then the
' menu event handlers will update m_FilterByName and m_FilterByExt. Set a checkmark
' next to the current filter operator before displaying the menu.
If m_FilterByName Then
mnuFilterByName.Checked = True
Else
mnuFilterByName.Checked = False
End If
If m_FilterByExt Then
mnuFilterByExt.Checked = True
Else
mnuFilterByExt.Checked = False
End If
CurrentView.PopupMenu mnuFilterOp, Left, Top
' MMC will generate a ResultViews_FilterChange event immediately after this
' in which we will update the result pane.
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_FilterButtonClick:
DisplayError "ResultViews_FilterButtonClick"
End Sub
' =============================================================================
' Method: mnuFilterByName_Click
' Type: Event
' Description: Fired when a the user selects "Filter by name" on the filter
' button popup menu
' Parameters: Index Index of the menu item clicked
' Selection Not used
' Output: None
' Notes: Changes the values of module level variables that store the
' filter operator
' =============================================================================
'
Private Sub mnuFilterByName_Click(ByVal Index As Long, ByVal Selection As SnapInLib.MMCClipboard)
m_FilterByName = True
m_FilterByExt = False
End Sub
' =============================================================================
' Method: mnuFilterByExt_Click
' Type: Event
' Description: Fired when a the user selects "Filter by extension" on the filter
' button popup menu
' Parameters: Index Index of the menu item clicked
' Selection Not used
' Output: None
' Notes: Changes the values of module level variables that store the
' filter operator
' =============================================================================
'
Private Sub mnuFilterByExt_Click(ByVal Index As Long, ByVal Selection As SnapInLib.MMCClipboard)
' Set the current filter operator
m_FilterByName = False
m_FilterByExt = True
End Sub
' =============================================================================
' Method: ResultViews_FilterChange
' Type: Event
' Description: Fired when a the user enters a new filter value or
' enables/disables fitlering
' Parameters: ResultView The ResultView in which the click occurred
' Column The column on which the the click occurred
' ChangeType Enable/Disable/New Value
'
' Output: None
'
' Notes: If value has changed then record the filter and refresh the
' result pane. If filtering has been disabled then refresh the
' result pane so that all files will be displayed.
' =============================================================================
'
Private Sub ResultViews_FilterChange(ByVal ResultView As SnapInLib.ResultView, _
ByVal Column As SnapInLib.MMCColumnHeader, _
ByVal ChangeType As SnapInLib.SnapInFilterChangeTypeConstants)
On Error GoTo ErrTrap_ResultViews_FilterChange
' If enabling, then there's nothing to do yet because the user hasn't entered
' any filter value
If ChangeType = siEnable Then
Exit Sub
End If
' If disabling then reset the filter value and refresh the result pane
If ChangeType = siDisable Then
m_FilterValue = "*"
FilterResultPane ResultView
Exit Sub
End If
' It is a filter value change. If this is not the Name column then ignore it
If Column.Key <> KEY_NAME Then
Exit Sub
End If
' Record the new filter value
m_FilterValue = Column.TextFilter
' Refresh the result pane and apply the filter
FilterResultPane ResultView
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_FilterChange:
DisplayError "ResultViews_FilterChange"
End Sub
' =============================================================================
' Method: ResultViews_Initialize
' Type: Event
' Description: Fired when a new ResultView is created.
' Parameters: ResultView A reference to the specific ResultView object
' being initialized
' Output: None
' Notes: This is the event used to trigger population of the ResultView.
' It only occurs as a ResultView is being created. It is not
' fired in response to changing the view mode. In normal
' operation, a ResultView's ListItems are destroyed when a new
' ResultView is created. ResultViews are not cached by default.
' Any ListSubItems attached to ScopeItems appearing in the result
' pane will appear automatically. We only need to explicitly add
' items that only exist in the ListView (i.e. the files).
' =============================================================================
'
Private Sub ResultViews_Initialize(ByVal ResultView As SnapInLib.IResultView)
On Error GoTo ErrTrap_ResultViews_Initialize
Dim Folder As Scripting.Folder
' It is a files listview.
With ResultView.ScopePaneItem
' We are only going to populate the ListView with files for
' a node that represents a drive (root directory) or a folder
If .ScopeItem.ScopeNode.NodeTypeName = SZ_DIRECTORY Then
' Let's first make sure that the drive represented by this
' ScopeItem is available to be queried (e.g. the A: drive
' may not have a floppy disk in it)
If m_FileSystemObject.GetDrive(m_FileSystemObject.GetDriveName(.ScopeItem.Key)).IsReady Then
' Get a reference to the folder object represented
' by the current scope node
Set Folder = m_FileSystemObject.GetFolder(.ScopeItem.Key)
End If
ElseIf .ScopeItem.ScopeNode.NodeTypeName = SZ_DESKTOP Then
' The Desktop is actually a special folder, that sits under
' \<Windows>\Profiles\<Current User>\Desktop, so we can
' have files to add to the ListView from here also.
Dim szPath As String * MAX_PATH ' Variable to receive the pathname into
Dim hModule As Long
Dim ProcAddr As Long
'
' Ask the Shell for the real path of the current user's Desktop folder
' Note: If IE is installed without the Desktop Update this API is not
' available. Therefore, we need to verify the API is available prior
' to making the call.
'
hModule = LoadLibrary("shell32.dll")
If hModule <> 0 Then
ProcAddr = GetProcAddress(hModule, "SHGetSpecialFolderPath")
If ProcAddr <> 0 Then
Dim hr As Long ' HRESULT for API call
hr = SHGetSpecialFolderPath(0, szPath, CSIDL_DESKTOP, False)
If hr = S_OK Or hr = S_FALSE Then
' If we got a valid string, try to open a folder object for it
Set Folder = m_FileSystemObject.GetFolder(szPath)
End If
End If
End If
' If the result view is filtered then switch to report mode as there is
' nothing to filter when the desktop is selected.
If ResultView.ListView.View = siFiltered Then
ResultView.ListView.View = siReport
End If
End If
' It is possible that the GetFolder call did not succeed. Check to
' see if there is a valid Folder object assigned to Folder.
If Not Folder Is Nothing Then
' Set up column filters.
If ResultView.ListView.View = siFiltered Then
SetUpFilter ResultView
End If
' Pass this folder object along with the ResultView object
' to the method that is actually responsible for adding the ListItems
AddFilesToView Folder, ResultView
End If
End With ' ResultView.ScopePaneItem
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_Initialize:
DisplayError "ResultViews_Initialize"
End Sub
' =============================================================================
' Method: ResultViews_InitializeControl
' Type: Event
' Description:
' Parameters: ResultView A reference to the specific ResultView object
' being activated
' Output: None
' Notes: This event is called when the ActiveX control used in an OCX
' result view is created. The snap-in may use it to set properties
' on the control. In this sample we set the text for the About
' information control.
' Note that from this event until the ResultView is destroyed
' (ResultViews_Terminate) the property ResultView.Control is
' valid.
' =============================================================================
'
Private Sub ResultViews_InitializeControl(ByVal ResultView As SnapInLib.IResultView)
On Error GoTo ErrTrap_ResultViews_InitializeControl
Dim Ctl As AboutCtl
Set Ctl = ResultView.Control
Ctl.AboutText = "About File Explorer"
Ctl.PropertySheetProvider = ResultView.ScopePaneItem.Parent.Parent.PropertySheetProvider
Ctl.RootScopeItem = ResultView.ScopePaneItem.ScopeItem
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_InitializeControl:
DisplayError "ResultViews_InitializeControl"
End Sub
' =============================================================================
' Method: ResultViews_ItemRename
' Type: Event
' Description:
' Parameters: ResultView A reference to the ResultView in which the
' rename operation occurred.
' ListItem The MMCListItem object representing the item
' that was renamed
' NewName The new name specified by the user
' Output: None
' Notes: This event is called when the user renames a list item by either
' slow double click on its text or by selecting Rename from the
' context menu.
' The file is renamed and the list item is reinitialized as the
' File object contained in its Tag property and its text are now
' out of date.
' ListItem.Update is called so that the text will be redrawn in
' the result pane.
' ListItem.UpdateAllViews is called to notify any other existing
' Views to update their display as well. This will result in the
' firing of the event ResultViews_ItemViewChange on all other
' views (see below).
' =============================================================================
'
Private Sub ResultViews_ItemRename(ByVal ResultView As SnapInLib.IResultView, _
ByVal ListItem As SnapInLib.IMMCListItem, _
ByVal NewName As String)
On Error GoTo ErrTrap_ResultViews_ItemRename
Dim File As Scripting.File
Dim OldPath As String
Dim NewPath As String
' Get the old path.
' We can get the File object from ListItem.Tag
Set File = ListItem.Tag
OldPath = File.Path
' Change the file name in the path
NewPath = Rename(OldPath, NewName)
' Rename the file
File.Move NewPath
' Reinitialize the list item from the altered file object
UpdateListItem ListItem, File
' Notify all other views that we have made the change. If there are other
' views then they will receive the ResultViews_ItemViewChange event and make
' the change in their corresponding list item.
'
' Send the old path as the hint so that the other views can find their
' existing list items. They will be able to get the new path from this
' list item as it will be passed as a parameter to
' ResultViews_ItemViewChange (see below).
ListItem.UpdateAllViews OldPath
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_ItemRename:
DisplayError "ResultViews_ItemRename"
End Sub
' =============================================================================
' Method: ResultViews_ItemViewChange
' Type: Event
' Description:
' Parameters: ResultView A reference to the ResultView in which the
' rename operation occurred.
' ListItem The MMCListItem object representing the item
' that has changed
' Hint Variant optionally passed to the
' MMCListItem.UpdateAllViews call that generated
' this event.
' Output: None
' Notes: This event is generated by a call to MMCListItem.UpdateAllViews.
' The MMCListItem passed here belongs to the generating view.
' In this sample the we find the list item in the specified
' result view and update it.
' =============================================================================
'
Private Sub ResultViews_ItemViewChange(ByVal ResultView As SnapInLib.IResultView, _
ByVal ListItem As SnapInLib.IMMCListItem, _
ByVal Hint As Variant)
On Error GoTo ErrTrap_ResultViews_ItemViewChange
Dim File As Scripting.File
Dim NewPath As String
Dim OurListItem As MMCListItem
' Determine whether this view is currently displaying this list item by
' searching for it using the old path as the key. The old path is received
' in Hint
On Error Resume Next
Set OurListItem = ResultView.ListView.ListItems(Hint)
On Error GoTo ErrTrap_ResultViews_ItemViewChange
If OurListItem Is Nothing Then
' It is not there. This view is displaying a different folder.
Exit Sub
End If
' We can get the File object from the source's ListItem.Tag
Set File = ListItem.Tag
' Get a new updated File object for the list item in this view.
Set File = m_FileSystemObject.GetFile(File.Path)
' Reinitialize the list item from the new file object
UpdateListItem OurListItem, File
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_ItemViewChange:
DisplayError "ResultViews_ItemViewChange"
End Sub
' =============================================================================
' Method: UpdateListItem
' Type: Subroutine
' Description: Reinitializes a list item's properties from a File object
'
' Parameters: ListItem The list item to be updated
' File A FileSystemObject File object whose properties
' are to be used to update the list item
'
' Output: None
' Notes: Reinitialize the list item's display strings, exported data,
' tag, and key. Tells MMC to update its display.
' =============================================================================
'
Private Sub UpdateListItem(ListItem As MMCListItem, _
File As Scripting.File)
On Error GoTo ErrTrap_UpdateListItem
' Update the list item's key to the new path
ListItem.Key = File.Path
' Update the ListItem's text property
ListItem.Text = File.Name
' Reinitialize the display properties,
InitListItem ListItem, File
' Reinitialize the exported data
InitListItemData ListItem, File
' Update the list item's display in the MMC listview
ListItem.Update
Exit Sub
' Error Handler for this method
ErrTrap_UpdateListItem:
DisplayError "UpdateListItem"
End Sub
' =============================================================================
' Method: ScopeItems_PropertyChanged
' Type: Event
' Description: Fired when a proeprty page calls ScopeItem.PropertyChanged
' Allows a property page to inform the snap-in that the user has
' changed its property values.
'
' Parameters: ScopeItem The ScopeItem for which the property page is
' displayed.
' Data The Data parameter passed by the property page
' when it called ScopeItem.PropertyChanged
'
' Output: None
' Notes: FileExplorer uses this event for the Internet Explorer node. The
' user enters a new URL to navigate to in the property page.
' =============================================================================
'
Private Sub ScopeItems_PropertyChanged(ByVal ScopeItem As SnapInLib.ScopeItem, _
ByVal Data As Variant)
On Error GoTo ErrTrap_ScopeItems_PropertyChanged
' If the ScopeItem is the Internet Explorer node then select it and display
' a URL view with URL in the Data parameter. Note that we don't call
' ScopePaneItem.DisplayNewResultView because the IE node may not be currently
' selected in the scope pane even though its property page is open. The user
' may have displayed properties, left the sheet open, and then returned to
' the scope pane and selected another node. This is possible because MMC
' displays property sheets in a separate thread.
If ScopeItem.ScopeNode.NodeTypeName = SZ_INTERNETEXPLORER Then
CurrentView.SelectScopeItem ScopeItem, siURLView, Data
End If
Exit Sub
' Error Handler for this method
ErrTrap_ScopeItems_PropertyChanged:
DisplayError "ScopeItems_PropertyChanged"
End Sub
' =============================================================================
' Method: ScopeItems_Rename
' Type: Event
' Description: Fired when the user performs a rename operation on a scope item.
'
' Parameters: ScopeItem The selected ScopeItem
' NewName New name given by the user.
'
' Output: None
' Notes: Rename the file and reinitialize the ScopeItem. Note that there
' is no equivalent of MMCListItem.UpdateAllViews for ScopeItems
' (see ResultViews_ItemRename above). MMC handles the propagation
' of the display changes to all existing views.
' =============================================================================
'
Private Sub ScopeItems_Rename(ByVal ScopeItem As SnapInLib.IScopeItem, _
ByVal NewName As String)
On Error GoTo ErrTrap_ScopeItems_Rename
Dim OldName As String
Dim Folder As Scripting.Folder
Dim OldPath As String
Dim NewPath As String
Set Folder = ScopeItem.Tag
OldPath = Folder.Path
' Change the folder name in the old path
NewPath = Rename(OldPath, NewName)
' Rename the folder
Folder.Move NewPath
' Change the key and name to the new path.
ScopeItem.Key = NewPath
ScopeItem.Name = NewPath
' Change the display name and the 1st column text to the new name
ScopeItem.ScopeNode.DisplayName = NewName
ScopeItem.ListSubItems(1).Text = NewName
' Change the exported data: Format is "Folder", data is folder path
ScopeItem.Data.SetData NewPath, "Folder"
Exit Sub
' Error Handler for this method
ErrTrap_ScopeItems_Rename:
DisplayError "ScopeItems_Rename"
End Sub
' =============================================================================
' Method: ResultViews_ListItemDblClick
' Type: Event
' Description:
' Parameters: ResultView The ResultView in which the double click occurred.
' ListItem MMCListItem object that was double clicked.
' DoDefault A flag to allow the snap-in to signal the
' Snap-in runtime whether to allow the default
' processing of a ListItem double-click.
' This value is initialized to TRUE. To disable
' default processing, set this parameter to FALSE.
' Output: None
' Notes: This event is handled for files. We call LaunchFile to
' run the file using the Win32 ShellExecute() API
' =============================================================================
'
Private Sub ResultViews_ListItemDblClick(ByVal ResultView As SnapInLib.IResultView, _
ByVal ListItem As SnapInLib.IMMCListItem, _
DoDefault As Boolean)
On Error GoTo ErrTrap_ResultViews_ListItemDblClick
LaunchFile ListItem.Key
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_ListItemDblClick:
DisplayError "ResultViews_ListItemDblClick"
End Sub
' =============================================================================
' Method: ResultViews_TaskClick
' Type: Event
' Description: Fired when the user clicks a task in a default taskpad
'
' Parameters: ResultView The ResultView in which the click occurred
' Task The Task clicked
'
' Output: None
' Notes: For the "Start File Explorer" task change the static node's
' result view to our standard listview lvExplorerTop.
' For the "MMC Home Page" task select the Internet Explorer node and
' display the MMC home page.
' For the "About..." task select the About node
' =============================================================================
'
Private Sub ResultViews_TaskClick(ByVal ResultView As SnapInLib.IResultView, _
ByVal Task As SnapInLib.ITask)
On Error GoTo ErrTrap_ResultViews_TaskClick
With CurrentScopePaneItem
If Task.Key = KEY_START Then
.DisplayNewResultView "lvExplorerTop", siPreDefined
ElseIf Task.Key = KEY_MMC_HOME_PAGE Then
EnsureDesktopExpanded
CurrentView.SelectScopeItem ScopeItems(SZ_INTERNETEXPLORER), siURLView, _
"http://www.microsoft.com/management/mmc/default.htm"
ElseIf Task.Key = KEY_ABOUT Then
EnsureDesktopExpanded
CurrentView.SelectScopeItem ScopeItems(SZ_ABOUT)
End If
End With
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_TaskClick:
DisplayError "ResultViews_TaskClick"
End Sub
' =============================================================================
' Method: EnsureDesktopExpanded
' Type: Subroutine
' Description: Checks if the desktop node has been expanded in the namespace.
' If not then expands it.
'
' Parameters: None
'
' Output: None
' Notes: None
' =============================================================================
'
Private Sub EnsureDesktopExpanded()
On Error GoTo ErrTrap_EnsureDesktopExpanded
Dim RootScopeItem As ScopeItem
' Determine whether the root scope item is the static node or the extension root
On Error Resume Next
Set RootScopeItem = ScopeItems(SZ_STATICNODE)
On Error GoTo ErrTrap_EnsureDesktopExpanded
If RootScopeItem Is Nothing Then
Set RootScopeItem = ScopeItems(SZ_EXTENSION_ROOT)
End If
' Check if the root scope item has been expanded. If not then expand it to add the
' desktop node.
If Not RootScopeItem.ScopeNode.ExpandedOnce Then
RootScopeItem.ScopeNode.ExpandInNameSpace
End If
' Check if the the desktop node has been expanded once. If not then expand it. We can
' use the Child property because the root node only has one child.
If Not RootScopeItem.ScopeNode.Child.ExpandedOnce Then
RootScopeItem.ScopeNode.Child.ExpandInNameSpace
End If
Exit Sub
' Error Handler for this method
ErrTrap_EnsureDesktopExpanded:
DisplayError "EnsureDesktopExpanded"
End Sub
' =============================================================================
' Method: ResultViews_TaskNotify
' Type: Event
' Description: Fired when a custom taskpad calls MMCCtrl.TaskNotify.
' Our User Guide custom taskpad calls this method when
' the user clicks the "Return to File Explorer" button.
' Parameters: Arg Passed by the taskpad to MMCCtrl.TaskNotify
' Param Passed by the taskpad to MMCCtrl.TaskNotify
'
' Output: None
' Notes: This method changes the result view for the static node to
' StaticNodeTaskpad
' =============================================================================
'
Private Sub ResultViews_TaskNotify(ByVal ResultView As SnapInLib.IResultView, _
ByVal Arg As Variant, _
ByVal Param As Variant)
On Error GoTo ErrTrap_ResultViews_TaskNotify
With Views.CurrentView.ScopePaneItems.SelectedItem
.DisplayNewResultView SZ_STATIC_NODE_TASKPAD, siPreDefined
End With
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_TaskNotify:
DisplayError "ResultViews_TaskNotify"
End Sub
' =============================================================================
' Method: ScopePaneItems_GetResultViewInfo
' Type: Event
' Description: Fired when a a scope item is selected in the scope pane to
' allow the snap-in to choose the result view that will be displayed.
'
' Parameters: ScopePaneItem A reference to the ScopePaneItem that was selected.
'
' ViewType Contains the default view type selected by the
' designer runtime. For nodes defined at design time
' that have default result views assigned, ViewType will
' be siPredefined. If the snap-in called
' ScopePaneItem.DisplayNewResultView then ViewType will
' contain the value passed to that method.
'
' DisplayString Contains the display string that accompanies
' ViewType. For predefined result views this will be the
' name of the result view defined at design time. For
' result views defined in code the contents vary based on
' the type. See the ScopePaneItem topic in the Snap-In
' Designer Programmer's Guide for more information.
'
' Output: The snap-in can change ViewType and DisplayString if needed.
'
' Notes: This event is handled by FileExplorer to set the URL to navigate to in
' the code-defined URL result view used for the Internet Explorer node.
' =============================================================================
'
Private Sub ScopePaneItems_GetResultViewInfo(ByVal ScopePaneItem As SnapInLib.ScopePaneItem, _
ViewType As SnapInLib.SnapInResultViewTypeConstants, _
DisplayString As String)
On Error GoTo ErrTrap_ScopePaneItems_GetResultViewInfo
' If the Internet Explore node was selected in the scope pane then specify a URL view
' and set the display string to the URL to navigate to. If it was selected
' programmatically because the user selected the "MMC Home Page" task on the static node
' taskpad then the ViewType and display string will already be set. If the
' user is returning to the node or using a property page to change the URL
' then the view type will already be siURLView an the display string will
' already be set to the URL.
If ScopePaneItem.ScopeItem.ScopeNode.NodeTypeName = SZ_INTERNETEXPLORER Then
If ViewType <> siURLView Then
ViewType = siURLView
DisplayString = "about:blank:"
End If
End If
Exit Sub
' Error Handler for this method
ErrTrap_ScopePaneItems_GetResultViewInfo:
DisplayError "ScopePaneItems_GetResultViewInfo"
End Sub
' =============================================================================
' Method: Views_Print
' Type: Event
' Description: Fired when a file is selected and the user clicks the
' printer toolbar button or selects "Print" on the context menu
' (both mechanisms are standard verbs supplied by MMC)
'
' Parameters: View A reference to the specific View object
' in which the print request occurred.
' Selection An MMCClipboard object that contains
' the currently selected items.
'
' Output: None
'
' Notes: Uses VB's Shell function to run the system command processor's
' "PRINT" command for all files in the selection.
' =============================================================================
'
Private Sub Views_Print(ByVal View As SnapInLib.View, _
ByVal Selection As SnapInLib.MMCClipboard)
On Error GoTo ErrTrap_Views_Print
Dim ListItem As MMCListItem
Dim File As Scripting.File
For Each ListItem In Selection.ListItems
Set File = ListItem.Tag
' Run the system command processor's print command
Shell Environ("ComSpec") & " /c PRINT " & File.Path
Next ListItem
Exit Sub
' Error Handler for this method
ErrTrap_Views_Print:
DisplayError "Views_Print"
End Sub
' =============================================================================
' Method: ScopeItems_Expand
' Type: Event
' Description: Fired in response to one of two user events. Either the ScopeItem
' is being expanded because the plus sign has been clicked or
' because ScopeItem node itself has been selected.
' Parameters: ScopeItem The ScopeItem being expanded
'
' Output: None
' Notes: Unlike the VB Common Controls TreeView control,
' the Expand event for an MMC snap-in is only called the
' first time a node is expanded.
' For "My Computer" adds the drives.
' For the Extension root adds the Desktop.
' For drives and folders, adds the subfolders.
' =============================================================================
'
Private Sub ScopeItems_Expand(ByVal ScopeItem As SnapInLib.IScopeItem)
On Error GoTo ErrTrap_ScopeItems_Expand
If ScopeItem.Key = SZ_STATICNODE Then
' In this case, we have already defined an auto-create subnode
' that represents the Desktop. We could use this opportunity to
' add additional nodes if, say, we wanted to display multiple
' desktops
ElseIf ScopeItem.Key = SZ_DESKTOP Or _
ScopeItem.Key = SZ_INTERNETEXPLORER Or _
ScopeItem.Key = SZ_NETWORKNEIGHBORHOOD Or _
ScopeItem.Key = SZ_RECYCLEBIN Or _
ScopeItem.Key = SZ_MYBRIEFCASE Or _
ScopeItem.Key = SZ_ABOUT Then
' In this current version of the sample, we are not populating any
' subnodes under these
ElseIf ScopeItem.Key = SZ_MYCOMPUTER Then
' We have now reached the computer node, and we need to add subnodes
' to represent each of the drives on the machine.
AddDrivesToScope ScopeItem.ScopeNode
ElseIf ScopeItem.Key = SZ_EXTENSION_ROOT Then
' The ScopeItem we added in ExtensionSnapIn_Expand has now been expanded
' itself. We manually add the Desktop node. When it is expanded, the
' auto-create nodes underneath it will be expanded just as when we are
' operating as a stand-alone console.
ScopeItems.AddPreDefined SZ_DESKTOP, SZ_DESKTOP, ScopeItem.ScopeNode, siParent
Else
' The expanded node is either a drive or a directory, which means that
' everything here will be folders. We need to add subnodes to represent
' all the subfolders of any given drive or folder. Because we are using
' the fully qualified pathname as the key for each folder ScopeItem, we
' can use this utility method to nest to any arbitrary depth
AddFoldersToScope ScopeItem
End If
Exit Sub
' Error Handler for this method
ErrTrap_ScopeItems_Expand:
DisplayError "ScopeItems_Expand"
End Sub
' =============================================================================
' Method: ScopeItems_Help
' Type: Event
' Description: Fired when the user selects a scope item and requests help.
' The snap-in should display context specific help for the selected
' ScopeItem.
'
' Parameters: ScopeItem The selected ScopeItem
'
' Output: None
' Notes: As an example, we display a topic in the MMC's
' help file. In general, the FileExplorer's .chm would be merged with MMC's because
' at design time because we set the HelpFile property to its file name.
' =============================================================================
'
Private Sub ScopeItems_Help(ByVal ScopeItem As SnapInLib.IScopeItem)
On Error GoTo ErrTrap_ScopeItems_Help
' Display the topic "File Explorer - Event Handling\ScopeItems"
ShowHelpTopic "mmc.chm::/sag_MMCconcepts0_0.htm"
Exit Sub
' Error Handler for this method
ErrTrap_ScopeItems_Help:
DisplayError "ScopeItems_Help"
End Sub
' =============================================================================
' Method: ResultViews_Help
' Type: Event
' Description: Fired when the user selects a list item and requests help.
' The snap-in should display context specific help for the selected
' list item.
'
' Parameters: ResultView The ResultView in which the request occurred.
' ListItem The selected list item.
'
' Output: None
' Notes: As an example, we display a topic in the MMC's
' help file. In general, the FileExplorer's .chm would be merged with MMC's because
' at design time because we set the HelpFile property to its file name.
' =============================================================================
'
Private Sub ResultViews_Help(ByVal ResultView As SnapInLib.IResultView, _
ByVal ListItem As SnapInLib.IMMCListItem)
On Error GoTo ErrTrap_ResultViews_Help
' Display the topic "File Explorer - Event Handling\ResultViews"
ShowHelpTopic "mmc.chm::/sag_MMCconcepts0_0.htm"
Exit Sub
' Error Handler for this method
ErrTrap_ResultViews_Help:
DisplayError "ResultViews_Help"
End Sub
' =============================================================================
' Method: ScopeItems_Initialize
' Type: Event
' Description: Fired when a ScopeItem has just been created
' Parameters: ScopeItem The new ScopeItem
'
' Output: None
' Notes: This is called once for each ScopeItem as it is being added
' to the ScopeItems collection. This event will fire for both
' auto-created and pre-defined nodes.
' Any pre-defined nodes that are being initialized here
' are being created by code elsewhere in this snap-in (see
' the ScopeItems_Expand event). For auto-create nodes, however,
' this is the only opportunity to trap their creation, and modify
' their properties before they are available for use. Note that
' pre-defined nodes could be initialized when they are added or
' in this event.
' =============================================================================
'
Private Sub ScopeItems_Initialize(ByVal ScopeItem As SnapInLib.IScopeItem)
On Error GoTo ErrTrap_ScopeItems_Initialize
With ScopeItem
' In order for the auto-create nodes to display properly in the
' ListView, we need to add ColumnHeaders and ListSubItems.
If .Key = SZ_STATICNODE Or _
.Key = SZ_EXTENSION_ROOT Then
.ColumnHeaders.Add 1, KEY_NAME, SZDISPLAY_NAME
.ListSubItems.Add 1, ScopeItem.Key, ScopeItem.ScopeNode.DisplayName
Set ScopeItem.Tag = m_ConfigData
ElseIf .Key = SZ_DESKTOP Or .Key = SZ_MYCOMPUTER Or _
.Key = SZ_INTERNETEXPLORER Or .Key = SZ_NETWORKNEIGHBORHOOD Or _
.Key = SZ_RECYCLEBIN Or .Key = SZ_MYBRIEFCASE Or .Key = SZ_ABOUT Then
With .ColumnHeaders
.Add 1, KEY_NAME, SZDISPLAY_NAME ' Column "Name"
.Add 2, KEY_TYPE, SZDISPLAY_TYPE ' Column "Type"
.Add 3, KEY_TOTALSIZE, SZDISPLAY_TOTALSIZE ' Column "Total Size"
.Add 4, KEY_FREESPACE, SZDISPLAY_FREESPACE ' Column "Free Space"
End With
' We're only adding one ListSubItem because the only column that
' really makes sense for these high level nodes is the "Name" column
.ListSubItems.Add 1, ScopeItem.Key, ScopeItem.ScopeNode.DisplayName
End If
End With ' ScopeItem
Exit Sub
' Error Handler for this method
ErrTrap_ScopeItems_Initialize:
DisplayError "ScopeItems_Initialize"
End Sub
' =============================================================================
' Method: SnapIn_QueryConfigurationWizard
' Type: Event
' Description: Fired when the user is adding the snap-in to the console in
' in MMC's Add/Remove snap-in dialog. Asks the snap-in whether it
' would like to display a configuration wizard before the snap-in
' is added.
'
' Parameters: HaveWizard Defaults to False. Set to True if the snap-in
' has a configuration wizard.
'
' Output: None
' Notes: None
' =============================================================================
'
Private Sub SnapIn_QueryConfigurationWizard(HaveWizard As Boolean)
HaveWizard = True
End Sub
' =============================================================================
' Method: SnapIn_CreateConfigurationWizard
' Type: Event
' Description: Fired after returning True from SnapIn_QueryConfigurationWizard
' (see above).
' Gives the snap-in the opportunity to add its property pages to
' the configuration wizard property sheet being displayed
' by MMC for the snap-in.
'
' Parameters: PropertySheet PropertySheet object used to add the snap-in's
' property pages.
'
' Output: None
' Notes: We add our configuration wizard property pages and pass the
' ConfigData object so that the pages can directly set its
' properties. When the user has completed the wizard the event
' SnapIn_ConfigurationComplete will be fired. FileExplorer does
' not handle that event.
' =============================================================================
'
Private Sub SnapIn_CreateConfigurationWizard(ByVal PropertySheet As SnapInLib.MMCPropertySheet)
On Error GoTo ErrTrap_SnapIn_CreateConfigurationWizard
' Clear the the configuration dirty property so we can detect changes when the
' wizard is done. (See SnapIn_ConfigurationComplete below).
m_ConfigData.ClearDirty
' Add the property pages to the wizard. Pass UseHelpButton=True so we get
' a help button on the property sheet.
PropertySheet.AddWizardPage "ppgWelcome", m_ConfigData, True
PropertySheet.AddWizardPage "ppgNetDrives", m_ConfigData, True
PropertySheet.AddWizardPage "ppgFolderAccess", m_ConfigData, True
PropertySheet.AddWizardPage "ppgFileAccess", m_ConfigData, True
PropertySheet.AddWizardPage "ppgFinish", m_ConfigData, True
Exit Sub
' Error Handler for this method
ErrTrap_SnapIn_CreateConfigurationWizard:
DisplayError "SnapIn_CreateConfigurationWizard"
End Sub
' =============================================================================
' Method: SnapIn_ConfigurationComplete
' Type: Event
' Description: Fired when the user clicks the Finish button on a wizard.
'
' Parameters: ConfigurationObject The object passed to
' MMCPropertySheet.AddWizardPage for the
' page displaying the Finish button.
' Output: None
' Notes: If any of the configuration settings were changed and the scope
' pane has already been populated with drives then refresh
' MyComputer so that it will repopulate according to the new
' settings (e.g. network drives were shown prior to running the
' wizard and now they are not to be shown anymore).
' =============================================================================
'
Private Sub SnapIn_ConfigurationComplete(ByVal ConfigurationObject As Object)
Dim MyComputer As ScopeItem
' Check if any configuration settings were change.
If Not m_ConfigData.Dirty Then
Exit Sub
End If
' Clear the the configuration dirty property
m_ConfigData.ClearDirty
' Check for the presence of "My Computer" in ScopeItems
On Error Resume Next
Set MyComputer = ScopeItems(SZ_MYCOMPUTER)
' Resume normal error processing
On Error GoTo ErrTrap_SnapIn_ConfigurationComplete
If MyComputer Is Nothing Then
Exit Sub
End If
' Check if "My Computer" has been expanded. If not then we don't need to
' refresh it.
If Not MyComputer.ScopeNode.ExpandedOnce Then
Exit Sub
End If
' "My Computer" is there and it has already been expanded so refresh it.
RefreshScopeItem MyComputer
Exit Sub
' Error Handler for this method
ErrTrap_SnapIn_ConfigurationComplete:
DisplayError "SnapIn_ConfigurationComplete"
End Sub
' =============================================================================
' Method: SnapIn_Initialize
' Type: Event
' Description: Fired whenever the snap-in created. When the user is adding a
' the snap-in to the console this event may be fired more than
' once because MMC will create the snap-in once to get display
' information for the Add/Remove dialog's listbox and then again
' if the user requests to add the snap-in. In general, this event
' should be used for quick initialization tasks (e.g. global
' variable initialization).
'
' Parameters: None
'
' Output: None
' Notes:
' =============================================================================
'
Private Sub SnapIn_Initialize()
On Error GoTo ErrTrap_SnapIn_Initialize
' Set default filter operator and value.
m_FilterByName = False
m_FilterByExt = True
m_FilterValue = "*"
' Load all static extensions up front so response time will be quicker
' when the user invokes properties, context menus etc.
' This should only be done for extensions that will be loaded often e.g. on
' every context menu invocation.
RequiredExtensions.EnableAllStatic True
Exit Sub
' Error Handler for this method
ErrTrap_SnapIn_Initialize:
DisplayError "SnapIn_Initialize"
End Sub
' =============================================================================
' Method: SnapIn_ReadProperties
' Type: Event
' Description: Fired when the user saves a console file (.MSC).
'
' Parameters: PropertyBag Used to store properties in the console file.
'
' Output: None
' Notes: Writes the values of the ConfigData object's properties that
' determine whether the user can see network drives and
' rename/delete files and folders.
' =============================================================================
'
Private Sub SnapIn_WriteProperties(ByVal PropertyBag As SnapInLib.PropertyBag)
On Error GoTo ErrTrap_SnapIn_WriteProperties
PropertyBag.WriteProperty "ShowNetDrives", m_ConfigData.ShowNetDrives
PropertyBag.WriteProperty "AllowFileAccess", m_ConfigData.AllowFileAccess
PropertyBag.WriteProperty "AllowFileAccess", m_ConfigData.AllowFolderAccess
Exit Sub
' Error Handler for this method
ErrTrap_SnapIn_WriteProperties:
DisplayError "SnapIn_WriteProperties"
End Sub
' =============================================================================
' Method: SnapIn_ReadProperties
' Type: Event
' Description: Fired when the user loads a console file (.MSC).
'
' Parameters: PropertyBag Used to read properties stored when saving the
' console in SnapIn_WriteProperties
'
' Output: None
' Notes: Reads the values of the ConfigData object's properties that
' determine whether the user can see network drives and
' rename/delete files and folders.
' =============================================================================
'
Private Sub SnapIn_ReadProperties(ByVal PropertyBag As SnapInLib.PropertyBag)
On Error GoTo ErrTrap_SnapIn_ReadProperties
m_ConfigData.ShowNetDrives = PropertyBag.ReadProperty("ShowNetDrives", False)
m_ConfigData.AllowFileAccess = PropertyBag.ReadProperty("AllowFileAccess", False)
m_ConfigData.AllowFolderAccess = PropertyBag.ReadProperty("AllowFileAccess", False)
Exit Sub
' Error Handler for this method
ErrTrap_SnapIn_ReadProperties:
DisplayError "SnapIn_ReadProperties"
End Sub
' =============================================================================
' Method: tbrFileMgr_ButtonClick
' Type: Event
' Description: Fired when a Toolbar button is clicked
' Parameters:
' Selection A reference to an MMCClipboard object that is
' holding a reference to the currently selected
' item(s)
' Button A reference to the button object attached to
' the toolbar button that was clicked
' Output: None
' Notes: Calls ProcessUICommand to do the work.
' =============================================================================
'
Private Sub tbrFileMgr_ButtonClick(ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Button As SnapInLib.IMMCButton)
On Error GoTo ErrTrap_tbrFileMgr_ButtonClick
ProcessUICommand Selection, Button.Key
Exit Sub
' Error Handler for this method
ErrTrap_tbrFileMgr_ButtonClick:
DisplayError "tbrFileMgr_ButtonClick"
End Sub
' =============================================================================
' Method: tbrMenuButton_ButtonDropDown
' Type: Event
' Description: Fired when a menu button is clicked and the dropdown menu is
' about to be displayed.
'
' Parameters: Selection A reference to an MMCClipboard object that is
' holding a reference to the currently selected
' item(s)
' Button A reference to the MMCButton object attached to
' the menu button.
' Output: None
' Notes: Examines the selection and enables/disable MMCButtonMenu items
' as appropriate.
' =============================================================================
'
Private Sub tbrMenuButton_ButtonDropDown(ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Button As SnapInLib.IMMCButton)
On Error GoTo ErrTrap_tbrMenuButton_ButtonDropDown
Dim ButtonMenu As MMCButtonMenu
Dim SelectionType As SnapInSelectionTypeConstants
SelectionType = Selection.SelectionType
' Disable everything then enable as needed.
For Each ButtonMenu In Button.ButtonMenus
ButtonMenu.Grayed = True
Next ButtonMenu
Button.ButtonMenus(KEY_CONFIGURATION).Grayed = False
' For files enable Run and Run As.
' For a single scope item, if it is a folder or a drive, then enable add
If (SelectionType = siSingleListItem) Or (SelectionType = siMultiListItems) Then
Button.ButtonMenus(KEY_RUN).Grayed = False
Button.ButtonMenus(KEY_RUNAS).Grayed = False
ElseIf SelectionType = siSingleScopeItem Then
If (TypeOf Selection.ScopeItems(1).Tag Is Scripting.Folder) Or _
(TypeOf Selection.ScopeItems(1).Tag Is Scripting.Drive) Then
Button.ButtonMenus(KEY_ADD).Grayed = False
End If
End If
Exit Sub
' Error Handler for this method
ErrTrap_tbrMenuButton_ButtonDropDown:
DisplayError "tbrMenuButton_ButtonDropDown"
End Sub
' =============================================================================
' Method: tbrMenuButton_ButtonMenuClick
' Type: Event
' Description: Fired when a Toolbar button is clicked
'
' Parameters: Selection A reference to an MMCClipboard object that is
' holding a reference to the currently selected
' item(s)
' ButtonMenu A reference to the MMCButtonMenu object attached to
' the menu item selected.
' Output: None
' Notes: Calls ProcessUICommand to do the work.
' =============================================================================
'
Private Sub tbrMenuButton_ButtonMenuClick(ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal ButtonMenu As SnapInLib.IMMCButtonMenu)
On Error GoTo ErrTrap_tbrMenuButton_ButtonMenuClick
ProcessUICommand Selection, ButtonMenu.Key
Exit Sub
' Error Handler for this method
ErrTrap_tbrMenuButton_ButtonMenuClick:
DisplayError "tbrMenuButton_ButtonMenuClick"
End Sub
' =============================================================================
' Method: Views_AddNewMenuItems
' Type: Event
' Description: Fired when a context menu is about to be displayed to give the
' snap-in the opportunity to add items to MMC's "New" sub-menu.
'
' Parameters: View The view in which the context menu
' invocation occurred. The context menu may
' have been invoked in either the scope pane
' or in the result pane.
' Selection MMCClipboard object containing the
' currently selected item(s).
' ContextMenu A ContextMenu object that allows adding the
' snap-in's menus.
' InsertionAllowed Defaults to True. If the snap-in sets it to
' False, then snap-ins that extend context
' menus for the selected item(s) will not be
' given the opportunity to alter the menu.
' Output: None
' Notes: For drives and folders adds mnuNew that has the item to create
' a new folder. For the Internet Explorer node adds a "URL..." item.
' =============================================================================
'
Private Sub Views_AddNewMenuItems(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal ContextMenu As SnapInLib.IContextMenu, _
InsertionAllowed As Boolean)
On Error GoTo ErrTrap_Views_AddNewMenuItems
If Selection.SelectionType = siSingleScopeItem Then
If (TypeOf Selection.ScopeItems(1).Tag Is Scripting.Drive) Or _
(TypeOf Selection.ScopeItems(1).Tag Is Scripting.Folder) Then
ContextMenu.AddMenu mnuNew
ElseIf Selection.ScopeItems(1).Key = SZ_INTERNETEXPLORER Then
ContextMenu.AddMenu mnuNewURL
End If
End If
Exit Sub
' Error Handler for this method
ErrTrap_Views_AddNewMenuItems:
DisplayError "Views_AddNewMenuItems"
End Sub
' =============================================================================
' Method: Views_AddTopMenuItems
' Type: Event
' Description: Fired when a context menu is about to be displayed to give the
' snap-in the opportunity to add items to the top of MMC's
' context menu.
'
' Parameters: View The view in which the context menu
' invocation occurred. The context menu may
' have been invoked in either the scope pane
' or in the result pane.
' Selection MMCClipboard object containing the
' currently selected item(s).
' ContextMenu A ContextMenu object that allows adding the
' snap-in's menus.
' InsertionAllowed Defaults to True. If the snap-in sets it to
' False, then snap-ins that extend context
' menus for the selected item(s) will not be
' given the opportunity to alter the menu.
' Output: None
' Notes: Enable items in mnuRun based on the selection and add it to
' to the context menu.
' =============================================================================
'
Private Sub Views_AddTopMenuItems(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal ContextMenu As SnapInLib.IContextMenu, _
InsertionAllowed As Boolean)
On Error GoTo ErrTrap_Views_AddTopMenuItems
' Gray everything and then we'll enable as needed
mnuRun.Grayed = True
mnuRun.Enabled = True
mnuRunAs.Grayed = True
mnuRunAs.Enabled = False
Select Case Selection.SelectionType
Case siSingleListItem
mnuRun.Grayed = False
mnuRun.Enabled = True
mnuRunAs.Grayed = False
mnuRunAs.Enabled = True
Case siMultiListItems
mnuRun.Grayed = False
mnuRun.Enabled = True
mnuRunAs.Grayed = False
mnuRunAs.Enabled = True
End Select
ContextMenu.AddMenu mnuContext
Exit Sub
' Error Handler for this method
ErrTrap_Views_AddTopMenuItems:
DisplayError "Views_AddTopMenuItems"
End Sub
' =============================================================================
' Method: Views_GetMultiSelectData
' Type: Event
' Description: Fired when the user selects multiple items in a listview. Allows
' the snap-in to export data for the multiple selection.
'
' Parameters: View The View in which the request occurred.
' Selection The selected items
' Data Empty data object. The snap-in should add any
' desired formats to be exported for extensions
' or for other instances of itself.
'
' Output: None
' Notes: Set "Folders" format as a string array containing the path of
' each folder.
' Set "Files" format as a string array containing the name of
' each file.
' Set "Paths" format as a string array containing the path of
' each file.
' =============================================================================
'
Private Sub Views_GetMultiSelectData(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Data As SnapInLib.IMMCDataObject)
On Error GoTo ErrTrap_Views_GetMultiSelectData
Dim Folders() As String
Dim cFolders As Long
Dim Folder As Scripting.Folder
Dim Files() As String
Dim Paths() As String
Dim cFiles As Long
Dim File As Scripting.File
Dim ScopeItem As ScopeItem
Dim ListItem As MMCListItem
Dim i As Long
cFolders = 0
' Count all the folders that are among the selected ScopeItems
For Each ScopeItem In Selection.ScopeItems
If TypeOf ScopeItem.Tag Is Scripting.Folder Then
cFolders = cFolders + 1
End If
Next ScopeItem
' If there are any folders then ReDim the string array and add each folder's
' path to the array. Set data format called "Folders" containing the string array.
If cFolders > 0 Then
ReDim Folders(1 To cFolders)
i = 1
For Each ScopeItem In Selection.ScopeItems
If TypeOf ScopeItem.Tag Is Scripting.Folder Then
Set Folder = ScopeItem.Tag
Folders(i) = Folder.Path
i = i + i
End If
Next ScopeItem
Data.SetData Folders, "Folders"
End If
' If there are any files in the selection then ReDim the string arrays and add
' each file's name and path to the arrays. Set data formats called "Files" and "Paths'
' containing the arrays.
cFiles = Selection.ListItems.Count
If cFiles = 0 Then
Exit Sub
End If
ReDim Files(1 To cFiles)
ReDim Paths(1 To cFiles)
i = 1
For Each ListItem In Selection.ListItems
Set File = ListItem.Tag
Files(i) = File.Name
Paths(i) = File.Path
i = i + 1
Next ListItem
Data.SetData Files, "Files"
Data.SetData Paths, "Paths"
Exit Sub
' Error Handler for this method
ErrTrap_Views_GetMultiSelectData:
DisplayError "Views_GetMultiSelectData"
End Sub
' =============================================================================
' Method: Views_QueryPagesFor
' Type: Event
' Description: Fired when the user requests properties for the selected
' items.
'
' Parameters: View The View in which the request occurred.
' Selection The selected items
' HasPropertyPages Defaults to False. Set to True if the snap-in
' has property pages for the selected items.
'
' Output: None
' Notes: We set HasPropertyPages=True for folders and files.
' =============================================================================
'
Private Sub Views_QueryPagesFor(ByVal View As SnapInLib.View, _
ByVal Selection As SnapInLib.MMCClipboard, _
HasPropertyPages As Boolean)
On Error GoTo ErrTrap_Views_QueryPagesFor
Dim ScopeItem As ScopeItem
' Assume no property pages.
HasPropertyPages = False
' If the selection is a single scope item and it is the static node or the
' extension root then the user has requested to run the configuration wizard.
' If it is the Internet Explorer node then the user has requested to display
' properties to enter a new URL. If it is the About node then the user has
' clicked the configuration button on the About OCX.
If Selection.SelectionType = siSingleScopeItem Then
If (Selection.ScopeItems(1).Key = SZ_STATICNODE) Or _
(Selection.ScopeItems(1).Key = SZ_EXTENSION_ROOT) Or _
(Selection.ScopeItems(1).Key = SZ_ABOUT) Or _
(Selection.ScopeItems(1).Key = SZ_INTERNETEXPLORER) Then
HasPropertyPages = True
Exit Sub
End If
End If
' If there are any list items then we do have property pages.
If Selection.ListItems.Count > 0 Then
HasPropertyPages = True
Exit Sub
End If
' Iterate through selected ScopeItems and see if any of them represents a
' folder.
For Each ScopeItem In Selection.ScopeItems
If TypeOf ScopeItem.Tag Is Scripting.Folder Then
HasPropertyPages = True
Exit Sub
End If
Next ScopeItem
Exit Sub
' Error Handler for this method
ErrTrap_Views_QueryPagesFor:
DisplayError "Views_QueryPagesFor"
End Sub
' =============================================================================
' Method: Views_CreatePropertyPages
' Type: Event
' Description: Fired when the user requests properties for the selected
' items and True has been returned from
' the Views_QueryPagesFor event. Gives the snap-in the chance
' to add its property pages to the property sheet being displayed
' by MMC for the selected items.
'
' Parameters: View The View in which the request occurred.
' Selection The selected items
' PropertySheet PropertySheet object used to add the snap-in's
' property pages.
'
' Output: None
' Notes: We add an instance of the ppgGeneral page for each folder and
' for each file. We pass the zero-based position of each page
' for the InitData parameter to PropertySheet.AddPage so that each
' page will know which object in PropertyPage.SelectedControls
' it needs to display properties for.
' =============================================================================
'
Private Sub Views_CreatePropertyPages(ByVal View As SnapInLib.View, _
ByVal Selection As SnapInLib.MMCClipboard, _
ByVal PropertySheet As SnapInLib.MMCPropertySheet)
On Error GoTo ErrTrap_Views_CreatePropertyPages
Dim Position As Long
Dim ScopeItem As ScopeItem
Dim ListItem As MMCListItem
Position = 0
' If the selection is a single scope item and it is the static node or the
' extension root then the user has requested to run the configuration wizard.
' We just invoke the SnapIn_CreateConfigurationWizard event handler as it does
' exactly that. If it is the Internet Explorer node then the user has requested
' to display properties to enter a new URL. If it is the About node then the
' user has clicked the configuration button on the About OCX.
If Selection.SelectionType = siSingleScopeItem Then
If (Selection.ScopeItems(1).Key = SZ_STATICNODE) Or _
(Selection.ScopeItems(1).Key = SZ_EXTENSION_ROOT) Or _
(Selection.ScopeItems(1).Key = SZ_ABOUT) Then
SnapIn_CreateConfigurationWizard PropertySheet
Exit Sub
ElseIf Selection.ScopeItems(1).Key = SZ_INTERNETEXPLORER Then
PropertySheet.AddPage "ppgBrowser"
End If
End If
' Add folder property pages first
For Each ScopeItem In Selection.ScopeItems
' If the ScopeItem represents a folder:
' Add an instance of ppgGeneral:
' Use the folder name as the caption
' True=Use Help Button
' False=Text is Left to Right
' Pass the page's position in the property sheet for the InitData parameter
If TypeOf ScopeItem.Tag Is Scripting.Folder Then
PropertySheet.AddPage "ppgGeneral", ScopeItem.ScopeNode.DisplayName, _
True, False, Str(Position)
Position = Position + 1
End If
Next ScopeItem
' Add file property pages
For Each ListItem In Selection.ListItems
' Use the file name as the caption
PropertySheet.AddPage "ppgGeneral", ListItem.Text, True, False, Str(Position)
Position = Position + 1
Next ListItem
Exit Sub
' Error Handler for this method
ErrTrap_Views_CreatePropertyPages:
DisplayError "Views_CreatePropertyPages"
End Sub
' =============================================================================
' Method: Views_QueryPaste
' Type: Event
' Description: Fired when MMC needs to determine whether to display the
' paste item on a context menu for a scope item and also when
' a drag occurs over a scope item.
'
' Parameters: DestView The destination view in which the paste may
' occur.
' SourceItems MMCClipboard object containing the item(s)
' that may be pasted.
' DestScopeItem The ScopeItem on which they may be pasted
' OKToPaste Defaults to False. If the snap-in sets it to
' True, then MMC will add the Paste item
' to the context menu for the ScopeItem or
' display the drop cursor over the ScopeItem.
' Output: None
' Notes: Examines the selection to determine whether a paste would be
' accepted.
' =============================================================================
'
Private Sub Views_QueryPaste(ByVal DestView As SnapInLib.IView, _
ByVal SourceItems As SnapInLib.IMMCClipboard, _
ByVal DestScopeItem As SnapInLib.IScopeItem, _
OKToPaste As Boolean)
On Error GoTo ErrTrap_Views_QueryPaste
Dim ScopeItem As ScopeItem
OKToPaste = False
' If the destination scope item is not a drive or a folder then
' we can't accept a paste
If (Not TypeOf DestScopeItem.Tag Is Scripting.Folder) And _
(Not TypeOf DestScopeItem.Tag Is Scripting.Drive) Then
Exit Sub
End If
' If the source items contain anything from another snap-in then we can't
' accept the paste
If (SourceItems.SelectionType = siSingleForeign) Or _
(SourceItems.SelectionType = siMultiForeign) Or _
(SourceItems.SelectionType = siMultiMixedForeign) Then
Exit Sub
End If
' If the source items contain any drives then we can't accept the paste
For Each ScopeItem In SourceItems.ScopeItems
If TypeOf ScopeItem.Tag Is Scripting.Drive Then
Exit Sub
End If
Next ScopeItem
' At this point we know the user is trying to paste either folders and/or files
' onto a drive or onto folder. We can accept this.
OKToPaste = True
Exit Sub
' Error Handler for this method
ErrTrap_Views_QueryPaste:
DisplayError "Views_QueryPaste"
End Sub
' =============================================================================
' Method: Views_Paste
' Type: Event
' Description: Fired when MMC needs to determine whether to display the
' paste item on a context menu for a scope item and also when
' a drag occurs over a scope item.
'
' Parameters: DestView The destination view in which the paste has
' occurred.
' SourceItems MMCClipboard object containing the item(s)
' that are being pasted.
' DestScopeItem The ScopeItem on which they may be pasted
' RetToSource An empty MMCDataObject that will be returned
' to the source of the paste if this is a move
' operation (as opposed to a copy). The contents
' of the returned data are defined by the source
' snap-in. When moving within a single snap-in
' it is not used. In that case the destination
' sets ScopeItem.Pasted and ListItem.Pasted on
' each successfully pasted item.
' Move True=a move operation. False=a copy operation.
'
' Output: None
' Notes: Pastes are only supported within the same instance of the
' FileExplorer (see Views_QueryPaste above). Performs the associated
' file operations ands sets Pasted on the processed items. For a
' Move operation, the removal of the source items is handled in
' the Views_Cut event (see below).
' =============================================================================
'
Private Sub Views_Paste(ByVal DestView As SnapInLib.IView, _
ByVal SourceItems As SnapInLib.IMMCClipboard, _
ByVal DestScopeItem As SnapInLib.IScopeItem, _
ByVal RetToSource As SnapInLib.IMMCDataObject, _
ByVal Move As Boolean)
On Error GoTo ErrTrap_Views_Paste
Dim Drive As Scripting.Drive
Dim Folder As Scripting.Folder
Dim File As Scripting.File
Dim DestPath As String
Dim ScopeItem As ScopeItem
Dim NewScopeItem As ScopeItem
Dim ListItems As MMCListItems
Dim ListItem As MMCListItem
Dim NewPath As String
Dim OKToPaste As Boolean
Dim DestScopeItemSelected As Boolean
Dim NewPathExists As Boolean
' In Views_QueryPaste we only allowed pasting of folders and/or files onto
' a drive or a folder so the source items must be of those types.
' Get the destination path
If TypeOf DestScopeItem.Tag Is Scripting.Drive Then
Set Drive = DestScopeItem.Tag
DestPath = Drive.Path
ElseIf TypeOf DestScopeItem.Tag Is Scripting.Folder Then
Set Folder = DestScopeItem.Tag
DestPath = Folder.Path
Else
Debug.Assert False
Exit Sub ' this should never happen
End If
' Iterate through the source folders and either move or copy them
' to the destination as requested. If there is not yet a scope item at the
' destination then add one. If there is a potential overwrite then ask the
' user to confirm the operation.
' Set PasteOK on each one.
For Each ScopeItem In SourceItems.ScopeItems
Set Folder = ScopeItem.Tag
NewPath = DestPath & "\" & Folder.Name
If m_FileSystemObject.FolderExists(NewPath) Then
OKToPaste = ConfirmOverwrite(NewPath)
NewPathExists = True
Else
OKToPaste = True
NewPathExists = False
End If
If OKToPaste Then
If Move Then
If NewPathExists Then
' File.Move won't overwrite an existing folder so we delete it first
m_FileSystemObject.DeleteFolder NewPath, True
End If
Folder.Move NewPath
Else
Folder.Copy NewPath, True
End If
' Check whether the new ScopeItem exists. If not then add it.
Set NewScopeItem = Nothing
If NewPathExists Then
On Error Resume Next
Set NewScopeItem = ScopeItems(NewPath)
On Error GoTo ErrTrap_Views_Paste
End If
If NewScopeItem Is Nothing Then
' If the destination ScopeItem has never been expanded, then
' expand it in the namespace now, That will cause the enumeration of
' subfolders which will see the newly added folder.
If Not DestScopeItem.ScopeNode.ExpandedOnce Then
DestScopeItem.ScopeNode.ExpandInNameSpace
Else
' The destination scope item has been expanded. Just add the new folder.
AddNewFolder DestScopeItem, m_FileSystemObject.GetFolder(NewPath)
End If
End If
ScopeItem.Pasted = True
End If
Next ScopeItem
' For files do the move or copy but only add the list item if
' DestScopeItem is the currently selected node in the scope pane.
With DestView.ScopePaneItems.SelectedItem
If .ScopeItem Is DestScopeItem Then
DestScopeItemSelected = True
Set ListItems = .ResultView.ListView.ListItems
Else
DestScopeItemSelected = False
End If
End With
For Each ListItem In SourceItems.ListItems
Set File = ListItem.Tag
NewPath = DestPath & "\" & File.Name
If m_FileSystemObject.FileExists(NewPath) Then
OKToPaste = ConfirmOverwrite(NewPath)
NewPathExists = True
Else
OKToPaste = True
NewPathExists = False
End If
If OKToPaste Then
If Move Then
If NewPathExists Then
' File.Move won't overwrite an existing file so we delete it first
m_FileSystemObject.DeleteFile NewPath, True
End If
File.Move NewPath
Else
File.Copy NewPath, True
End If
ListItem.Pasted = True
If DestScopeItemSelected And (Not NewPathExists) Then
AddNewFile ListItems, m_FileSystemObject.GetFile(NewPath)
End If
End If
Next ListItem
Exit Sub
' Error Handler for this method
ErrTrap_Views_Paste:
DisplayError "Views_Paste"
End Sub
' =============================================================================
' Method: Views_Cut
' Type: Event
' Description: Fired on the source snap-in following the Views_Paste event
' during a Move operation to allow the source to delete the pasted
' items.
'
' Parameters: View The view from which the items were cut
' ItemsPasted MMCClipboard object containing the item(s)
' that were cut and pasted.
' RetFromTarget An MMCDataObject containing data returned
' from the target of the paste if the target
' is not the same instance of the same snap-in.
' When moving within a single snap-in
' it is not used. In that case the destination
' set ScopeItem.Pasted and ListItem.Pasted on
' each successfully pasted item.
'
' Output: None
' Notes: Pastes are only supported within the same instance of the
' FileExplorer (see Views_QueryPaste above). Checks the Pasted
' property on each item and removes the corresponding ScopeItem
' or list item.
' =============================================================================
'
Private Sub Views_Cut(ByVal View As SnapInLib.IView, _
ByVal ItemsPasted As SnapInLib.IMMCClipboard, _
ByVal RetFromTarget As SnapInLib.IMMCDataObject)
On Error GoTo ErrTrap_Views_Cut
Dim ScopeItem As ScopeItem
Dim ListItem As MMCListItem
' Each pasted scope item must be removed from the scope items collection. The
' actual file operation was done in Views_Paste.
For Each ScopeItem In ItemsPasted.ScopeItems
If ScopeItem.Pasted Then
ScopeItems.Remove (ScopeItem.Key)
End If
Next ScopeItem
' For list items we need to check whether they belong to the currently selected
' scope pane item. If so then we need to delete them. We do the check by using the
' key of one of the pasted items as an index into the current result view's list items.
' As with scope items, the actual file operation was done in Views_Paste so we are
' only updating MMC here.
If ItemsPasted.ListItems.Count = 0 Then
Exit Sub
End If
With View.ScopePaneItems.SelectedItem.ResultView.ListView
On Error Resume Next
Set ListItem = .ListItems(ItemsPasted.ListItems(1).Key)
On Error GoTo ErrTrap_Views_Cut
If ListItem Is Nothing Then
Exit Sub
End If
' The list items are from the current result view so delete them.
For Each ListItem In ItemsPasted.ListItems
If ListItem.Pasted Then
.ListItems.Remove ListItem.Key
End If
Next ListItem
End With
Exit Sub
' Error Handler for this method
ErrTrap_Views_Cut:
DisplayError "Views_Cut"
End Sub
' =============================================================================
' Method: Views_Delete
' Type: Event
' Description: Fired when the user initiates a delete operation by selecting
' items and hitting the delete key, or by selecting "Delete" from
' the context menu, or by clicking the delete toolbar button. (All
' of these UI elements are supplied by MMC as a result of enabling
' the console delete verb.
'
' Parameters: View The view in which the delete request occurred.
' Selection MMCClipboard object containing the item(s)
' that are to be deleted.
'
' Output: None
' Notes: Performs the file operation and deletes the scope items and/or
' list items.
' =============================================================================
'
Private Sub Views_Delete(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard)
On Error GoTo ErrTrap_Views_Delete
Dim ScopeItem As ScopeItem
Dim ListItem As MMCListItem
Dim Folder As Scripting.Folder
Dim File As Scripting.File
Dim Choice As Integer
' Request confirmation from the user before deleting
Choice = ConsoleMsgBox("Are you sure you want to delete the selected items?", _
vbYesNo, "FileExplorer")
If Choice = vbNo Then
Exit Sub
End If
' Delete the scope items from MMC and the folders from the file system
For Each ScopeItem In Selection.ScopeItems
Set Folder = ScopeItem.Tag
Folder.Delete True ' True=Delete even if read-only
ScopeItems.Remove (ScopeItem.Key)
Next ScopeItem
' Delete the list items from MMC and the files from the file system
With View.ScopePaneItems.SelectedItem.ResultView.ListView
For Each ListItem In Selection.ListItems
Set File = ListItem.Tag
File.Delete True ' True=Delete even if read-only
.ListItems.Remove (ListItem.Key)
Next ListItem
End With
Exit Sub
' Error Handler for this method
ErrTrap_Views_Delete:
DisplayError "Views_Delete"
End Sub
' =============================================================================
' Method: RefreshScopeItem
' Type: Event
' Description: Fired when the user requests to refresh the view
' by hitting F5 or selecting "Refresh"
' from the context menu.
'
' Parameters: ScopeItem ScopeItem to be refreshed
'
' Output: None
' Notes: Removes all of the child scope items and then iterates through
' the sub-folders and adds them back. If the scope item is
' currently selected in the scope pane then calls
' ScopePaneItem.DisplayNewResultView to refresh the result
' view.
' =============================================================================
'
Private Sub RefreshScopeItem(ByVal ScopeItem As SnapInLib.ScopeItem)
On Error GoTo ErrTrap_RefreshScopeItem
Dim Drive As Scripting.Drive
Dim SubFolders As Scripting.Folders
Dim Folder As Scripting.Folder
Dim Child As ScopeNode
Dim ChildName As String
' Remove all of the child scope items of the refreshed scope item. We do this
' first so that we can reiterate through the sub-folders of this scope item and
' pick up any changes (renames, deletes, additions) done outside of FileExplorer
Set Child = ScopeItem.ScopeNode.Child
' This could also be done by simply calling ScopeItem.RemoveChildren. The
' technique used here is to demonstrate iteration of scope nodes.
While Not Child Is Nothing
ChildName = ScopeItems(Child).Name
Set Child = Child.Next
ScopeItems.Remove ChildName
Wend
' Invoke the ScopeItems_Expand event handler is it knows how to populate the
' children of a given ScopeItem
ScopeItems_Expand ScopeItem
' If the refreshed scope item is currently selected in the scope pane then
' refresh the result pane contents. This can be done by calling
' ScopePaneItem.DisplayNewResultView using the current display string and result
' view type.
If CurrentScopePaneItem Is Nothing Then
Exit Sub
End If
If ScopeItem Is CurrentScopePaneItem.ScopeItem Then
CurrentScopePaneItem.DisplayNewResultView CurrentScopePaneItem.DisplayString, CurrentScopePaneItem.ResultViewType
End If
Exit Sub
' Error Handler for this method
ErrTrap_RefreshScopeItem:
DisplayError "RefreshScopeItem"
End Sub
' =============================================================================
' Method: Views_Refresh
' Type: Event
' Description: Fired when the user requests to refresh the view
' by hitting F5 or selecting "Refresh"
' from the context menu.
'
' Parameters: View A reference to the specific View object
' in which the refresh request occurred.
' Selection An MMCClipboard object that contains
' the currently selected items.
'
' Output: None
' Notes: We support refresh for scope items only.
' Checks selection and calls subroutine RefreshScopeItem to do the work.
' =============================================================================
'
Private Sub Views_Refresh(ByVal View As SnapInLib.View, _
ByVal Selection As SnapInLib.MMCClipboard)
On Error GoTo ErrTrap_Views_Refresh
' Double check that the selection is indeed a single scope item and assign it to
' a local variable
If Selection.SelectionType <> siSingleScopeItem Then
Exit Sub
End If
RefreshScopeItem Selection.ScopeItems(1)
Exit Sub
' Error Handler for this method
ErrTrap_Views_Refresh:
DisplayError "Views_Refresh"
End Sub
' =============================================================================
' Method: Views_Select
' Type: Event
' Description: Occurs when the user selects item(s) in either the scope
' pane or in the result pane of a particular view.
' Parameters: View A reference to the specific View object
' in which the selection occurred.
' Selection An MMCClipboard object that contains
' the currently selected items.
' Selected A boolean indicating whether the items are
' being selected or de-selected
' ConsoleVerbs An IMMCConsoleVerbs interface that allows
' the snap-in to enable/disable the console verbs
' such as rename and delete.
' Output: None
' Notes: Determine which types of objects are currently selected and
' enable the console verbs we support for that combination of
' objects. Update the status bar with number of objects selected,
' total size of objects selected, and disk free space.
' =============================================================================
'
Private Sub Views_Select(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Selected As Boolean, _
ByVal ConsoleVerbs As SnapInLib.IMMCConsoleVerbs)
On Error GoTo ErrTrap_Views_Select
Dim ScopeItem As ScopeItem
Dim ListItem As MMCListItem
Dim Drive As Scripting.Drive
Dim Folder As Scripting.Folder
Dim File As Scripting.File
Dim szDisplayText As String
Dim DiskSpaceAvailable As Double
Dim TotalSelectedFileSize As Double
Dim SelectionType As SnapInSelectionTypeConstants
SelectionType = Selection.SelectionType
' Start out by disabling everything.
' We will then enable as needed
ConsoleVerbs(siOpen).Enabled = False
ConsoleVerbs(siCopy).Enabled = False
ConsoleVerbs(siPaste).Enabled = False
ConsoleVerbs(siDelete).Enabled = False
ConsoleVerbs(siProperties).Enabled = False
ConsoleVerbs(siRename).Enabled = False
ConsoleVerbs(siRefresh).Enabled = False
ConsoleVerbs(siPrint).Enabled = False
ConsoleVerbs(siCut).Enabled = False
' If the selection is a single scope item and it is the static node then there is
' nothing to do because there is nothing to enable and MMC does not allow displaying
' anything in the status bar in this case. This code also handles the case where
' FileExplorer is extending the Computer Management snap-in in Windows 2000 and the
' ExtensionRoot node is selected.
If SelectionType = siSingleScopeItem Then
If Selection.ScopeItems(1).Key = SZ_STATICNODE Or _
Selection.ScopeItems(1).Key = SZ_EXTENSION_ROOT Then
Exit Sub
End If
End If
' If the static node is currently selected in the scope pane then there is also
' nothing to do for the same reason. In this case the selection would be
' the desktop node in the result pane.
If Not View.ScopePaneItems.SelectedItem Is Nothing Then
With View.ScopePaneItems.SelectedItem.ScopeItem
If (.Name = SZ_STATICNODE) Or (.Name = SZ_EXTENSION_ROOT) Then
Exit Sub
End If
End With
End If
' If this is a deselection then don't enable anything and clear the status bar.
If Not Selected Then
View.SetStatusBarText ""
Exit Sub
End If
' Examine the selection and determine which verbs to enable
' For "My Computer" enable refresh
' For "Internet Explorer" enable properties.
' For a drive enable refresh if it has already been expanded. Always enable paste.
' This doesn't imply that the system clipboard currently contains something that we
' can paste. It only tells MMC that we can potentially paste on this selection
' and that it should ask us before displaying its context menu or enabling its
' paste button. When MMC does ask we will receive a Views_QueryPaste event.
' For a single folder enable properties.
' If it has already been expanded then enable refresh.
' Always enable paste for same reason described above for a drive.
' If permissions allow, enable cut, copy, rename, and delete
' For multiple folders, if permissions allow, enable cut, copy, and delete.
' For a single file enable properties and print.
' If permissions allow, then enable cut, copy, rename, and delete.
' For multiple files enable print.
' If permissions allow, then enable cut, copy, and delete.
' For mixed folders and files, if permissions allow enable cut, copy, and delete.
Select Case SelectionType
Case siSingleScopeItem
Set ScopeItem = Selection.ScopeItems(1)
If ScopeItem.Key = SZ_MYCOMPUTER Then
If ScopeItem.ScopeNode.ExpandedOnce Then
ConsoleVerbs(siRefresh).Enabled = True
End If
ElseIf ScopeItem.Key = SZ_INTERNETEXPLORER Then
If ScopeItem.ScopeNode.ExpandedOnce Then
ConsoleVerbs(siProperties).Enabled = True
End If
ElseIf TypeOf ScopeItem.Tag Is Scripting.Drive Then
If ScopeItem.ScopeNode.ExpandedOnce Then
ConsoleVerbs(siRefresh).Enabled = True
End If
ConsoleVerbs(siPaste).Enabled = True
ElseIf TypeOf ScopeItem.Tag Is Scripting.Folder Then
If ScopeItem.ScopeNode.ExpandedOnce Then
ConsoleVerbs(siRefresh).Enabled = True
End If
ConsoleVerbs(siProperties).Enabled = True
ConsoleVerbs(siPaste).Enabled = True
' Check permissions for other verbs
If m_ConfigData.AllowFolderAccess Then
ConsoleVerbs(siCut).Enabled = True
ConsoleVerbs(siCopy).Enabled = True
ConsoleVerbs(siRename).Enabled = True
ConsoleVerbs(siDelete).Enabled = True
End If
End If
Case siSingleListItem
ConsoleVerbs(siProperties).Enabled = True
ConsoleVerbs(siPrint).Enabled = True
' Check permissions for other verbs
If m_ConfigData.AllowFileAccess Then
ConsoleVerbs(siCut).Enabled = True
ConsoleVerbs(siCopy).Enabled = True
ConsoleVerbs(siRename).Enabled = True
ConsoleVerbs(siDelete).Enabled = True
End If
Case siMultiScopeItems
' If there is anything other than a folder then don't enable anything
For Each ScopeItem In Selection.ScopeItems
If Not TypeOf ScopeItem.Tag Is Scripting.Folder Then
Exit Sub
End If
Next ScopeItem
ConsoleVerbs(siProperties).Enabled = True
' It is all folders. Check permissions for allowable verbs
If m_ConfigData.AllowFolderAccess Then
ConsoleVerbs(siCut).Enabled = True
ConsoleVerbs(siCopy).Enabled = True
ConsoleVerbs(siDelete).Enabled = True
End If
Case siMultiListItems
ConsoleVerbs(siPrint).Enabled = True
ConsoleVerbs(siProperties).Enabled = True
' Check permissions for other verbs
If m_ConfigData.AllowFileAccess Then
ConsoleVerbs(siCut).Enabled = True
ConsoleVerbs(siCopy).Enabled = True
ConsoleVerbs(siDelete).Enabled = True
End If
Case siMultiMixed
' If the ScopeItems are anything other than folders then don't enable anything
For Each ScopeItem In Selection.ScopeItems
If Not TypeOf ScopeItem.Tag Is Scripting.Folder Then
Exit Sub
End If
Next ScopeItem
ConsoleVerbs(siProperties).Enabled = True
' It is all folders and files. Check permissions for allowable verbs
If m_ConfigData.AllowFolderAccess And m_ConfigData.AllowFileAccess Then
ConsoleVerbs(siCut).Enabled = True
ConsoleVerbs(siCopy).Enabled = True
ConsoleVerbs(siDelete).Enabled = True
End If
End Select
' Gather data for the status bar string. Count the selected objects, get the disk
' free space, and add up the size of any selected files.
TotalSelectedFileSize = 0
If Selection.ListItems.Count > 0 Then
For Each ListItem In Selection.ListItems
Set File = ListItem.Tag
TotalSelectedFileSize = TotalSelectedFileSize + File.Size
Next ListItem
End If
' Determine the drive. One of the selected objects will lead us to it
Set Drive = Nothing
If Selection.ListItems.Count > 0 Then
Set File = Selection.ListItems(1).Tag
Set Drive = File.Drive
ElseIf Selection.ScopeItems.Count > 0 Then
For Each ScopeItem In Selection.ScopeItems
If Drive Is Nothing Then
If TypeOf ScopeItem.Tag Is Scripting.Folder Then
Set Folder = ScopeItem.Tag
Set Drive = Folder.Drive
ElseIf TypeOf ScopeItem.Tag Is Scripting.Drive Then
Set Drive = ScopeItem.Tag
End If
Else
Exit For
End If
Next ScopeItem
End If
' Put together the status bar string
szDisplayText = CStr(Selection.ListItems.Count + Selection.ScopeItems.Count) & " Object(s) selected" & Chr$(9)
szDisplayText = szDisplayText & FormatByteCount(TotalSelectedFileSize)
If Not Drive Is Nothing Then
If Drive.IsReady Then
szDisplayText = szDisplayText & Chr$(9) & "(Disk free space: " & FormatByteCount(Drive.AvailableSpace) & ")"
End If
End If
' Disable for now due to MMC bug
View.SetStatusBarText szDisplayText
Exit Sub
' Error Handler for this method
ErrTrap_Views_Select:
DisplayError "Views_Select"
End Sub
' =============================================================================
' Method: Views_SetControlbar
' Type: Event
' Description: Fired before a view is displayed. It allows a snap-in to
' add or remove its toolbars and menu buttons.
' Parameters: View A reference to the current view object (as
' represented by the MDI Child window containing
' the snap-in)
' Controlbar A reference to the controlling object that
' manages the snap-in's toolbars and menu buttons
' Output: None
' Notes: While toolbars and menu buttons are added or removed through
' this event, the application always has access to the Toolbar
' object. Enabling/disabling or hiding/showing of individual
' buttons or button menus can be done at any time.
' =============================================================================
'
Private Sub Views_SetControlbar(ByVal View As SnapInLib.IView, _
ByVal Controlbar As SnapInLib.IMMCControlbar)
On Error GoTo ErrTrap_Views_SetControlbar
' Attach the one toolbar we have in this snap-in
Controlbar.Attach tbrFileMgr
' Attach the one menu button we have in this snap-in
Controlbar.Attach tbrMenuButton
Exit Sub
' Error Handler for this method
ErrTrap_Views_SetControlbar:
DisplayError "Views_SetControlbar"
End Sub
' =============================================================================
' Method: Views_UpdateControlbar
' Type: Event
' Description: Called following a selection change to allow the snap-in to
' update its toolbar(s) and menu buttons according to the
' selected item(s).
' Parameters: View A reference to the specific View object
' in which the selection has changed.
' Selection An MMCClipboard object that contains
' the current selection
' Selected A boolean showing whether the items are
' being selected or de-selected
' Controlbar A reference to the controlling object that
' manages the snap-in's toolbars and menu buttons
' Output: None
' Notes: Examine the selection and determine which toolbar buttons to
' enable. Always enable the menu button. If the user clicks
' the menu button we will enable/disable the individual menu
' items according to the selection. (See
' tbrMenuButton_ButtonDropDown above).
' =============================================================================
'
Private Sub Views_UpdateControlbar(ByVal View As SnapInLib.IView, _
ByVal Selection As SnapInLib.IMMCClipboard, _
ByVal Selected As Boolean, _
ByVal Controlbar As SnapInLib.IMMCControlbar)
On Error GoTo ErrTrap_Views_UpdateControlbar
Dim Button As MMCButton
Dim SelectionType As SnapInSelectionTypeConstants
SelectionType = Selection.SelectionType
' First disable everything. Then enable as needed
For Each Button In tbrFileMgr.Buttons
Button.Enabled = False
Next Button
' If we are deselecting then don't enable anything
If Selected = False Then
Exit Sub
End If
' For files enable Run and Run As.
' For a single scope item, if it is a folder or a drive, then enable Add
With tbrFileMgr
If (SelectionType = siSingleListItem) Or _
(SelectionType = siMultiListItems) Then
.Buttons(KEY_RUN).Enabled = True
.Buttons(KEY_RUNAS).Enabled = True
ElseIf SelectionType = siSingleScopeItem Then
If (TypeOf Selection.ScopeItems(1).Tag Is Scripting.Folder) Or _
(TypeOf Selection.ScopeItems(1).Tag Is Scripting.Drive) Then
.Buttons(KEY_ADD).Enabled = True
End If
End If
End With
' Always enable our menu button. If the user clicks it then in the
' tbrMenuButton_ButtonDropDown event we will enable/disable individual items
tbrMenuButton.Buttons(1).Enabled = True
Exit Sub
' Error Handler for this method
ErrTrap_Views_UpdateControlbar:
DisplayError "Views_UpdateControlbar"
End Sub