intelliproject logo

Location: Desktop development - C/C++    License: The Intelliproject Open License (IPOL)

Create shortcuts with the IShellLink Interface in Visual C++

Posted by Silviu Caragea

Describe how to create shortcuts with the IShellLink Interface in Visual C++

Skill: Intermediate

Posted: 11/10/2008

Views: 1364

Rating: 4.00 /5

Popularity: 0.00

Sign Up to vote for this article

Introduction

The IShellLink interface allows Shell links to be created, modified, and resolved but it has no concept of how to read or write itself to a file on disk.

In order to provide file access, the IShellLink interface required to support the IPersistFile , an interface that provides methods for reading and writing to and from disk.

The source code

Using the code

You should call CoInitialize or CoInitializeEx in your application before calling CreateShortCut .This functions initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment (STA). Applications must initialize the COM library before they can call COM library functions other than CoGetMalloc and memory allocation functions.

License

This article, along with any associated source code and files, is licensed under The Intelliproject Open License (IPOL)

About the author

Silviu Caragea

Silviu Caragea is the Founder, Administrator and Chief Editor who wrote and runs The IntelliProject.

He's been programming since 2000 and now he's student at The Faculty of Economic Cybernetics, Statistics and Informatics from Bucharest. In the same time he's working as software developer at Cratima Software, a Romanian software and web design company that activates both on the local and foreign market, providing its customers with software development services, internet and intranet solutions, web design, graphic design and IT consultancy.

His programming experience includes:
- C,C++, Visual C++(Win32 API, MFC, ADO, STL, DAO, ODBC, ATL, COM, DirectShow, DirectDraw, WTL)
- Open Source libraries :CURL & Boost
- HTML, CSS
- Java (SE,ME)
- JavaScript, Ajax, Google Web Toolkit (GWT)
- Php, MySQL
-Oracle, PL SQL
- C# .NET
-Objective C, IPhone SDK, Cocoa

Location: Romania
Ocupation: Software Engineer
Home page: http://www.intelliproject.net

Posted by Faizal at 31/01/2009 23:43
Thanks for the code
what files should I include ?
Posted by Silviu Caragea at 01/02/2009 11:13
#include <windows.h>
#include <atlstr.h>
#include <shobjidl.h>
#include <shlguid.h>
And do not forget to call CoInitialize ( NULL ); as show in my example.
Posted by Faizal at 01/02/2009 12:37
Cannot open include file: 'atlstr.h': No such file or directory
Posted by coder at 26/01/2010 01:41
nice article is there a way but if someone coding in C is there a way i could call it using C ? or it's only uses classes?

Sign up to post message on the article message board!