Solved

IShellLink Interface

Posted on 1999-01-05
5
214 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 189
Named range not carried over 10 65
Modbus - whats the maximum I can store in one register? 4 80
sumHeights  challenge 17 73
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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