Click here to Skip to main content
14,930,087 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to everyone,

I have a little question about .URL file (a shortcut file that linked to a web page).

How can I programmatically retrieve the URL from this file using MFC/C++ ?

How can I programmatically write an URL to a file ?

[edit]In explorer, I right click and create new shortcut.
In the first screen I enter an URL text like :
In the second screen I enter a name for my shortcut like : mylink
After this, I got a file called mylin.url, the .url is not visible in the explorer view.
So, what I want to do is programmatically create/modify/read the URL from such files in MFC/C++
Updated 28-Jan-11 2:27am
Richard MacCutchan 28-Jan-11 8:28am
Please don't update your question by posting as answer; just edit the question, and leave a comment in the answer you are responding to.

What do you mean by "retrieve the URL from this file"? Which file are you referring to? If you have the information stored in a text file then you can use the standard library fstream or the MFC CFile to access it.
OK, you want to read and write shortcuts, try How to create and resolve a shortcut[^], a nice CodeProject article.
Create a text file with content similar to the following:

and save it with a ".url" extension.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900