?
Solved

Path and filename to last opened file

Posted on 2006-11-30
7
Medium Priority
?
280 Views
Last Modified: 2010-04-17
Hi!

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 :)
0
Comment
Question by:temj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:EverLearningCodeMonkey
ID: 18046103
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?

http://msdn2.microsoft.com/en-us/library/ms632714.aspx

http://www.icsharpcode.net/OpenSource/SD/forum/topic.asp?TOPIC_ID=8969

http://www.icsharpcode.net/opensource/sd/Forum/topic.asp?TOPIC_ID=3169&SearchTerms=,IshellLink

http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp

http://www.vbaccelerator.com/home/NET/Code/Libraries/Shell_Projects/Creating_and_Modifying_Shortcuts/article.asp
0
 

Author Comment

by:temj
ID: 18048442
Very interessting, too bad that I'm using java, because this would actually solve my problem.
0
 
LVL 3

Accepted Solution

by:
EverLearningCodeMonkey earned 800 total points
ID: 18048790
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:
http://www.koders.com/java/fid3DF3F093AEEE26411291E2492862A087FF9C6F5F.aspx

If all else fails and you feel like getting into the guts of the .lnk files then this document (apparently) would be the roadmap.
http://mediasrv.ns.ac.yu/extra/fileformat/windows/lnk/shortcut.pdf

Hope this helps
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:temj
ID: 18049945
I wasn't able to compile the java version of the IShellLink, cause of missing links. But I'm looking into that other document.
0
 

Expert Comment

by:leroopsin
ID: 18054030
I think you can use JNI which you help you call a C++/COM/DCOM inside Java.  Please refer to the link "http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html" how to know to develop a JNI function.
0
 
LVL 3

Expert Comment

by:EverLearningCodeMonkey
ID: 18054225
I took a closer look at the ShellLink.java 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.

http://www.izforge.com/izpack/downloads

0
 

Author Comment

by:temj
ID: 18065042
Problem solved :)

I had to visit www.izforge.com/downloads, and downloaded the sourcefiles for the izpack project, and imported it into my project, to be able to compile the ShellLink.java file and use it. It works great :)

Thank you all for helping me out with this one.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Progress
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question