Path and filename to last opened file


I need to get the path and filename to the last file a user opened. I know there is some ways to get it, like in Documents And Settings\<User>\Recent. And there is also stored information in the register in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs, but only the name of the file is stored there, not the path.

The thing is, that I want my application to automaticly start and then load a file that has been opened outside the application. It's the same thing as all the office application does, like word or excel. When a user doubleclicks on a document, word starts and loads the document.

Please help :)
Who is Participating?

Improve company productivity with a Business Account.Sign Up

EverLearningCodeMonkeyConnect With a Mentor Commented:
Ahhh...Well that changes things significantly.

In light of this new information, I did find a couple other links you might be interested in:

This would appear to be a java Port of the IShellLink interface, (all the same methods seem to be there) - Hopefully it does the trick:

If all else fails and you feel like getting into the guts of the .lnk files then this document (apparently) would be the roadmap.

Hope this helps
Hi temj,

One approach you may want to try is to utilize the IShellLink Interface.  The Recent Folder under documents and settings is populated with shortcuts, which store the paths back to the actual files.  Apparently the IShellLink interface is one way to access the information in shortcuts.  I don't know what language you use but here's some links I found to pages that deal with this.  The GetPath and Resolve methods specifically would seem to be what you'd want.  

NOTE: These articles may not focus on those calls specifically but they should show you how to access the interface and from there you should be able to use those methods.  These articles focus on implementing the interface in .Net - What language are you using?,IshellLink
temjAuthor Commented:
Very interessting, too bad that I'm using java, because this would actually solve my problem.
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

temjAuthor Commented:
I wasn't able to compile the java version of the IShellLink, cause of missing links. But I'm looking into that other document.
I think you can use JNI which you help you call a C++/COM/DCOM inside Java.  Please refer to the link "" how to know to develop a JNI function.
I took a closer look at the file - the package and a couple of the imports refer to IzPack which is also written by the same person it's available at the following link.

Perhaps that will rectify the problem.

temjAuthor Commented:
Problem solved :)

I had to visit, and downloaded the sourcefiles for the izpack project, and imported it into my project, to be able to compile the file and use it. It works great :)

Thank you all for helping me out with this one.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.