RecentFilesRegistryHelper.vb
' Copyright 2012 ESRI ' ' All rights reserved under the copyright laws of the United States ' and applicable international laws, treaties, and conventions. ' ' You may freely redistribute and use this sample code, with or ' without modification, provided you include the original copyright ' notice and use restrictions. ' ' See the use restrictions. ' Imports System.Collections.Generic Imports Microsoft.Win32 Module RecentFilesRegistryHelper Const RecentFileRegistryKeyPath As String = "Software\ESRI\{0}\Recent File List" ''' <summary> ''' Helper function to process recent file lists stored in the registry ''' </summary> Public Function GetRecentFiles(ByVal app As ESRI.ArcGIS.Framework.IApplication) As String() Dim recentFilePaths As List(Of String) = New List(Of String) 'Read the registry to get the recent file list Dim openKey As String = String.Format(RecentFileRegistryKeyPath, app.Name) Dim recentListKey As RegistryKey = Registry.CurrentUser.OpenSubKey(openKey) If Not recentListKey Is Nothing Then Dim listNames As String() = recentListKey.GetValueNames() For Each name As String In listNames Dim fileName As String = recentListKey.GetValue(name, String.Empty).ToString() If Not String.IsNullOrEmpty(fileName) Then recentFilePaths.Add(fileName) End If Next End If Return recentFilePaths.ToArray() End Function End Module