JayJay101
JayJay101

Reputation: 1

How to add file to Recent Docunents in .NET?

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?

Upvotes: 0

Views: 61

Answers (1)

JayJay101
JayJay101

Reputation: 1

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)

Upvotes: 0

Related Questions