forked from lee-soft/ViStart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContextMenu.cls
70 lines (54 loc) · 1.84 KB
/
ContextMenu.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "ContextMenu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private WithEvents m_vistaMenu As frmVistaMenu
Attribute m_vistaMenu.VB_VarHelpID = -1
Public Id As String
Public Function PopupMenu(ownerForm As Form) As Form
Set PopupMenu = m_vistaMenu
m_vistaMenu.Resurrect True, ownerForm
End Function
Public Function PopulateViaXML(contextMenuObj As IXMLDOMElement) As Boolean
Dim thisItem As IXMLDOMElement
Dim thisObject As Object
Set m_vistaMenu = New frmVistaMenu
If Not AttributeExists(contextMenuObj, "id") Then
PopulateViaXML = False
Exit Function
End If
Id = contextMenuObj.Attributes.getNamedItem("id").Text
For Each thisObject In contextMenuObj.childNodes
If TypeName(thisObject) = "IXMLDOMElement" Then
Set thisItem = thisObject
If thisItem.nodeName = "item" Then
m_vistaMenu.AddItem thisItem.Attributes.getNamedItem("caption").Text, thisItem.Attributes.getNamedItem("program").Text
End If
End If
Next
End Function
Private Sub m_vistaMenu_onClick(theItemTag As String)
m_vistaMenu.Hide
If Is64bit Then
Dim win64Token As New Win64FSToken
win64Token.EnableFS
'ExplorerRun theFilePath
If AppLauncherHelper.ShellEx(theItemTag) = APIFALSE Then Exit Sub
Set win64Token = Nothing
Else
If AppLauncherHelper.ShellEx(theItemTag) = APIFALSE Then Exit Sub
End If
End Sub
Private Sub m_vistaMenu_onInActive()
m_vistaMenu.Hide
End Sub