0

I'm trying to figure out how to add a file to the recent documents using .NET. In this post SHAddToRecentDocs doesn't add my file to recent documents it shows how to do it via C# but how do I do it with VB.NET? Is it possible?

Kit
  • 20,354
  • 4
  • 60
  • 103
JayJay101
  • 1
  • 1

1 Answers1

0

Thank you for your help! Using https://converter.telerik.com/ I was able to figure it out.

This is what I used:

Public Enum ShellAddToRecentDocsFlags
    Pidl = &H1
    Path = &H2
    PathW = &H3
End Enum

<DllImport("Shell32.dll", BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
Private Shared Sub SHAddToRecentDocs(ByVal flag As ShellAddToRecentDocsFlags,
<MarshalAs(UnmanagedType.LPStr)> ByVal path As String)
JayJay101
  • 1
  • 1