You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows Startmenu Items
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Open()
if TargetWin32 then
run
else
MsgBox "This example does only work on Windows."
end if
End EventHandler
Sub run()
dim i,c as integer
dim k as string
WindowsAppNames.init
dic=WindowsAppNames.names
c=dic.Count-1
for i=0 to c
k=dic.Key(i)
Listbox1.AddRow dic.Value(k).StringValue
Listbox1.Cell(listbox1.LastIndex,1)=k
next
End Sub
Property dic As dictionary
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Module WindowsAppNames
Sub init()
dim f as FolderItem
dic=new Dictionary
f=WindowsStartMenuMBS(-32763)
run f
f=WindowsStartMenuMBS(-32766)
run f
End Sub
Function names() As dictionary
Return dic
End Function
Private Sub run(f as folderitem)
dim i,c as integer
dim g as FolderItem
if f<>nil then
c=f.Count
for i=1 to c
g=f.TrueItem(i)
if g.Visible then
if g.Directory then
run g
else
runitem g
end if
end if
next
end if
End Sub
Private Sub runitem(f as folderitem)
dim s as new WindowsShortCutMBS
dim n,e4 as string
dim g as FolderItem
dim t,k as string
System.DebugLog f.NativePath
n=f.name
if Right(n,4)=".lnk" then
s.Location=f.NativePath
if s.ResolveShortCut(true,true) then
t=s.Target
e4=Right(t,4)
if e4=".exe" then
k=NthField(t,"\",CountFields(t,"\"))
dic.Value(k)=n
end if
end if
end if
End Sub
Property Private dic As dictionary
End Module