Solved

IShellLink Interface

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 111
How to determine file rename from EventLog ? 2 57
has77  challenge 9 96
EvenOdd challenge 10 142
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

685 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