Solved

IShellLink Interface

Posted on 1999-01-05
5
222 Views
Last Modified: 2013-11-20
How do I implement a Shell Link to activate a Desktop shortcut?
0
Comment
Question by:jnick
[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
5 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1327238
What do you mean by "activate a Desktop shortcut"?  Do you mean to create a desktop shortcut or do you want to "invoke" the object pointed to by the shortcut?
0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1327239
If you want to create a shortcut, there is code at http://www.codeguru.com/shell/filelinks.shtml. Use the SHGetSpecialFolderPath function with the CSIDL_COMMON_DESKTOPDIRECTORY or CSIDL_DESKTOPDIRECTORY flags to get the desktop directory. And you can use the ShellExecute or ShellExecuteEx functions to execute a shortcut.
0
 

Expert Comment

by:dagangwang
ID: 1327240
It is not difficult to do. See SDK help about "ShellLink", there are some good samples.
0
 

Author Comment

by:jnick
ID: 1327241
Re: chensu's answer. I am trying your solution. However, I am having a bit of difficulty using SHGetSpecialFolderPath. According to the documentation I can use this function on Windows95 as long as I have IE 4.x installed which I do. I have included shlobj.h and set my include directories to look in mssdk\include. I still get "error C2065: 'SHGetSpecialFolderPath' : undeclared identifier" error. I've even tried defining _WIN32_IE == 0x0400. Any ideas on how to use this function?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1327242
This is because the SDK you are using is not the latest. You need the latest Platform SDK. You may get it on MSDN CDs or download it at http://msdn.microsoft.com/developer/sdk/platform.htm. Another way is to use the SHGetSpecialFolderLocation and SHGetPathFromIDList functions which do not rely on IE4.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

739 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