Click here to Skip to main content
Click here to Skip to main content

How to create and resolve a shortcut

By , 6 Oct 2003
 

Introduction

Shortcut is a file with an extension .lnk. Each of these files contain a special COM object that points to another file. Usually, when you try to open a .lnk file, the system opens a file which this shortcut points to.

Let's do the following experiment. Create a text file (file with an extension .txt) somewhere. Then create a shortcut pointing to this file (send me a private e-mail if you do not know how to create a shortcut manually). Then try to open the shortcut with Microsoft Word, using File->Open command and select just created shortcut. MS Word will do it correctly: it will open the text file that is pointed by this shortcut. Now do the same with Notepad. Instead of the text file content, you will see garbage. It means that Notepad has no idea how to deal with shortcuts.

So we came to a conclusion: in Windows a program should have a built-in support for shortcuts in order to handle them correctly.

In this article I will show how to do it. I will present 2 functions: how to create and resolve the shortcut. The code is well commented (in my opinion) and self-explanatory.

Code

/**********************************************************************
* Function......: CreateShortcut
* Parameters....: lpszFileName - string that specifies a valid file name
*          lpszDesc - string that specifies a description for a 
                             shortcut
*          lpszShortcutPath - string that specifies a path and 
                                     file name of a shortcut
* Returns.......: S_OK on success, error code on failure
* Description...: Creates a Shell link object (shortcut)
**********************************************************************/
HRESULT CreateShortcut(/*in*/ LPCTSTR lpszFileName, 
                    /*in*/ LPCTSTR lpszDesc, 
                    /*in*/ LPCTSTR lpszShortcutPath)
{
    HRESULT hRes = E_FAIL;
    DWORD dwRet = 0;
    CComPtr<IShellLink> ipShellLink;
        // buffer that receives the null-terminated string 
        // for the drive and path
    TCHAR szPath[MAX_PATH];    
        // buffer that receives the address of the final 
        //file name component in the path
    LPTSTR lpszFilePart;    
    WCHAR wszTemp[MAX_PATH];
        
    // Retrieve the full path and file name of a specified file
    dwRet = GetFullPathName(lpszFileName, 
                       sizeof(szPath) / sizeof(TCHAR), 
                       szPath, &lpszFilePart);
    if (!dwRet)                                        
        return hRes;

    // Get a pointer to the IShellLink interface
    hRes = CoCreateInstance(CLSID_ShellLink,
                            NULL, 
                            CLSCTX_INPROC_SERVER,
                            IID_IShellLink,
                            (void**)&ipShellLink);

    if (SUCCEEDED(hRes))
    {
        // Get a pointer to the IPersistFile interface
        CComQIPtr<IPersistFile> ipPersistFile(ipShellLink);

        // Set the path to the shortcut target and add the description
        hRes = ipShellLink->SetPath(szPath);
        if (FAILED(hRes))
            return hRes;

        hRes = ipShellLink->SetDescription(lpszDesc);
        if (FAILED(hRes))
            return hRes;

        // IPersistFile is using LPCOLESTR, so make sure 
                // that the string is Unicode
#if !defined _UNICODE
        MultiByteToWideChar(CP_ACP, 0, 
                       lpszShortcutPath, -1, wszTemp, MAX_PATH);
#else
        wcsncpy(wszTemp, lpszShortcutPath, MAX_PATH);
#endif

        // Write the shortcut to disk
        hRes = ipPersistFile->Save(wszTemp, TRUE);
    }

    return hRes;
}

/*********************************************************************
* Function......: ResolveShortcut
* Parameters....: lpszShortcutPath - string that specifies a path 
                                     and file name of a shortcut
*          lpszFilePath - string that will contain a file name
* Returns.......: S_OK on success, error code on failure
* Description...: Resolves a Shell link object (shortcut)
*********************************************************************/
HRESULT ResolveShortcut(/*in*/ LPCTSTR lpszShortcutPath,
                        /*out*/ LPTSTR lpszFilePath)
{
    HRESULT hRes = E_FAIL;
    CComPtr<IShellLink> ipShellLink;
        // buffer that receives the null-terminated string 
        // for the drive and path
    TCHAR szPath[MAX_PATH];     
        // buffer that receives the null-terminated 
        // string for the description
    TCHAR szDesc[MAX_PATH]; 
        // structure that receives the information about the shortcut
    WIN32_FIND_DATA wfd;    
    WCHAR wszTemp[MAX_PATH];

    lpszFilePath[0] = '\0';

    // Get a pointer to the IShellLink interface
    hRes = CoCreateInstance(CLSID_ShellLink,
                            NULL, 
                            CLSCTX_INPROC_SERVER,
                            IID_IShellLink,
                            (void**)&ipShellLink); 

    if (SUCCEEDED(hRes)) 
    { 
        // Get a pointer to the IPersistFile interface
        CComQIPtr<IPersistFile> ipPersistFile(ipShellLink);

        // IPersistFile is using LPCOLESTR, 
                // so make sure that the string is Unicode
#if !defined _UNICODE
        MultiByteToWideChar(CP_ACP, 0, lpszShortcutPath,
                                       -1, wszTemp, MAX_PATH);
#else
        wcsncpy(wszTemp, lpszShortcutPath, MAX_PATH);
#endif

        // Open the shortcut file and initialize it from its contents
        hRes = ipPersistFile->Load(wszTemp, STGM_READ); 
        if (SUCCEEDED(hRes)) 
        {
            // Try to find the target of a shortcut, 
                        // even if it has been moved or renamed
            hRes = ipShellLink->Resolve(NULL, SLR_UPDATE); 
            if (SUCCEEDED(hRes)) 
            {
                // Get the path to the shortcut target
                hRes = ipShellLink->GetPath(szPath, 
                                     MAX_PATH, &wfd, SLGP_RAWPATH); 
                if (FAILED(hRes))
                    return hRes;

                // Get the description of the target
                hRes = ipShellLink->GetDescription(szDesc,
                                             MAX_PATH); 
                if (FAILED(hRes))
                    return hRes;

                lstrcpyn(lpszFilePath, szPath, MAX_PATH); 
            } 
        } 
    } 

    return hRes;
}

Using the code

The following code will show how you may use these functions.

void HowToCreateShortcut()
{
    LPCTSTR lpszFileName = _T("C:\\Work\\Window.exe");
    LPCTSTR lpszShortcutDesc = _T("Anything can go here");
    LPCTSTR lpszShortcutPath = 
_T("C:\\Documents and Settings\\Administrator\\Desktop\\Sample Shortcut.lnk");

    CreateShortcut(lpszFileName, lpszShortcutDesc, lpszShortcutPath);
}

void HowToResolveShortcut()
{
    LPCTSTR lpszShortcutPath = 
_T("C:\\Documents and Settings\\Administrator\\Desktop\\Sample Shortcut.lnk");
    TCHAR szFilePath[MAX_PATH];

    ResolveShortcut(lpszShortcutPath, szFilePath);
}

That's it.

License

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

About the Author

Igor Vigdorchik
Web Developer
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberAndreas Strauss25 Oct '12 - 6:43 
Does exactly what I need. Thx a lot!
GeneralWhy this article is similiar with "http://msdn.microsoft.com/en-us/library/aa969393.aspx"membertransoft13 Jun '11 - 11:17 
http://msdn.microsoft.com/en-us/library/aa969393.aspx[^]
GeneralRe: Why this article is similiar with "http://msdn.microsoft.com/en-us/library/aa969393.aspx"memberIgor Vigdorchik18 Jul '11 - 12:34 
Maybe because this article was written in 2003 when the mentioned MSDN article was not even available.
Generalhttp://msdn.microsoft.com/en-us/library/aa969393.aspxmembertransoft13 Jun '11 - 11:16 
http://msdn.microsoft.com/en-us/library/aa969393.aspx[^]
GeneralHow about shortcut under "Start" "All Programs"?membertransoft13 Jun '11 - 7:36 
If there is a shortcut under "Start" "All Programs",
 
Then "lpszShortcutPath " should be?
 
------------------------------------------------------------------------------
LPCTSTR lpszShortcutPath =
_T("C:\\Documents and Settings\\Administrator\\Desktop\\Sample Shortcut.lnk");
------------------------------------------------------------------------------
Generalhttp linkmemberlimelect23 May '11 - 2:37 
If i have a .lnk file
that point to a link of http://.... type
HOW do i get the string http://.....
GetPath or GetDescription or any thing else
do not give me a solution.
the GetWorkingDirectory give me system32 as path
but i want the string http:////
any help???
GeneralResolving can be simpler : AfxResolveShortcutmemberAlexandre GRANVAUD17 Jan '10 - 23:17 
AfxResolveShortcut() does it !
GeneralRe: Resolving can be simpler : AfxResolveShortcutmemberYogurt25 Jan '11 - 10:39 
Supposing you are using MFC and have MFC installed on the computer...
Furthermore, AfxResolveShortcut may pop up a window (this is why it requires its first parameter) and this is unacceptable for some programs (such as services).
Generalcreate url shortcutmemberKeith K. S. Lee21 Aug '08 - 23:11 
Instead of file shortcut, how can I create url shortcut?
Moreover, can I change the icon of shortcut?
 
Thanks
 
Keith K. S. Lee
In Taiwan

GeneralRe: create url shortcutmemberIgor Vigdorchik22 Aug '08 - 15:58 
Create a text file with the following format, and name it SOMETHING.URL:
[InternetShortcut]
URL=http://www.codeproject.com
GeneralDoesn't work anything!!!memberCapitanevs12 Nov '07 - 3:04 
Excuse me, but I'm a total beastD'Oh! | :doh: in Win32 applications.
I can read and write C++ code, but I completely ignore the
frame of 'define' and 'include' I need...
 
I have an empty *.cpp file (and VC6 compiler). I copy and paste
your CreateShortcut and ResolveShortcut functions.
 
What else do I need??WTF | :WTF:
 
I tried to write like this:
---------------------------------------
#include
#include
#include
#include

++++++++++++++++++++
your code here
++++++++++++++++++++

void main
{
cout << "hello world";
}
--------------------------------------
------------------------------------
 
but I got a lot of weird errors likeCry | :((
 
c:\prg\main\vs\vc98\include\winbase.h(3833) : error C2065: 'MAX_PATH' : undeclared identifier
c:\prg\main\vs\vc98\include\winbase.h(3833) : error C2057: expected constant expression
c:\prg\main\vs\vc98\include\winbase.h(3833) : warning C4200: nonstandard extension used : zero-sized array in struct/union
c:\prg\main\vs\vc98\include\winbase.h(3834) : error C2229: struct '_WIN32_FIND_DATAA' has an illegal zero-sized array
c:\prg\main\vs\vc98\include\winbase.h(3850) : error C2057: expected constant expression
c:\prg\main\vs\vc98\include\winbase.h(3850) : warning C4200: nonstandard extension used : zero-sized array in struct/union
c:\prg\main\vs\vc98\include\winbase.h(3851) : error C2229: struct '_WIN32_FIND_DATAW' has an illegal zero-sized array
 
It seems there is some include missing, cause even "MAX_PATH" is not defined.
What should i do?
 
Haven't you got a full-working standalone example?
 

 
D'Oh! | :doh: WTF | :WTF:
GeneralRe: Doesn't work anything!!!memberIgor Vigdorchik12 Nov '07 - 5:34 
No, I do not have a standalone example.
You have to have WTL installed and set up on your computer. Then create a Win32 project using a WTL provided wizard.
GeneralVery Helpful. ThanksmemberSoftwareGeek13 Aug '07 - 23:49 
Igor,
 
Thanks for this article.
I found it very useful.
Generalcant include atlbase.hmembermohsen nourian1 Feb '06 - 20:31 
i include this but it says not found
even i copied it manualy in project folder but some other files needed ??!!
how ever why should we use ATL ?? and what can i do?
 

GeneralRe: cant include atlbase.hmemberIgor Vigdorchik2 Feb '06 - 5:45 
On my pc it's in C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include (I have VS2003).
Make sure this path (where it's on your pc) is listed in the project options.
GeneralDelete the UNC path informationmemberasimeqi12 Apr '05 - 8:42 

I am creating a shortcut on my machine and distributing it to several other machines.
The shortcut points to an executable on the local machine (Say C:\IE\IEinstall.exe).
Unfortunately the shortcut contains the UNC path to my machine. This creates problems when that path can be resolved from another machine but the logged on user on that machine does not have permissions for my machine (it may fail in other cases but this is definitely a case when it fails).
 
I would like to remove the UNC path information from my shortcut. There is a KB article about this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;150215
But I cannot find the tool mentioned in there in the resource kit.
Does anybody know where can I find that tool?
Or does anybody know the binary format of the shortcut so that I can remove the UNC by hand?

GeneralArgumentsmemberVadimeti14 Nov '04 - 4:07 
How can I create a shortcut for programm that called with
an argument : "c:\myfile.exe -arg"
Thank you .
GeneralRe: ArgumentsmemberIgor Vigdorchik14 Nov '04 - 7:46 
Use IShellLink::SetArguments(LPCTSTR pszArgs) method.
GeneralGetPath may "succeed" without returning a pathmember--.-4 Nov '04 - 9:59 
From MSDN documentation on GetPath:

Returns NOERROR if the operation is successful and a valid path is retrieved. If the operation is successful, but no path is retrieved, it returns S_FALSE and pszFile will be empty.

Therefore, I believe the "if" below GetPath should be
 
    if (hRes != NOERROR)
 
instead of
 
    if (FAILED(hRes))
GeneralRe: GetPath may &quot;succeed&quot; without returning a pathmemberIgor Vigdorchik4 Nov '04 - 10:49 
There is no difference between these 2 statements.
GeneralRe: GetPath may &quot;succeed&quot; without returning a pathmember--.-4 Nov '04 - 11:32 
I find the following definitions in winerror.h:
 
#define NOERROR 0
#define SUCCEDED(status) ((HRESULT)(Status) >= 0)
#define FAILED(status) ((HRESULT)(Status)<0)
 
Hence there is a difference-- a return of zero is not considered a FAILure, but it does not provide useful data for my purpose.
GeneralRe: GetPath may &quot;succeed&quot; without returning a pathmemberIgor Vigdorchik4 Nov '04 - 11:43 
--.- wrote:
it does not provide useful data for my purpose
 
But I am not looking for an useful data, all I want to know if I get a valid path.
And if I don't then I bail out, if I do then I continue. This is a purpose of SUCCEDED and FAILED macros.
GeneralRe: GetPath may "succeed" without returning a pathmemberAbraxas2325 Dec '11 - 15:32 
To set the record straight S_FALSE is a 'success' code and hence will not be caught by the FAILED macro. The call to IShellLink::GetPath may 'succeed' and yet not return a valid path.
QuestionRelease?sussAnonymous13 Sep '04 - 23:09 
From my limited understanding of COM, I thought that you should call
pShellLink->Release();
in a couple of places to say that you had finished with the interface.
However, when I try this it causes compiler errors ???

AnswerRe: Release?memberIgor Vigdorchik19 Sep '04 - 5:18 
CComPtr is a smart pointer class, it does automatic reference counting through calls to AddRef and Release. So you never call Release().
GeneralproblemmemberMister Transistor30 Jun '04 - 1:48 
Sorry to be dim but although your code is well-commented, I don't understand the principle of what it is doing. I tried to use this in a VC++6 app under ME -I added the headers
#include <stdafx.h>
#include <atlbase.h>
#include <ShlObj.h>
and it compiled and linked first time. However, it does not resolve a shortcut. Debug shows that the call
      hRes = CoCreateInstance(CLSID_ShellLink,
                                          NULL,
                                          CLSCTX_INPROC_SERVER,
                                          IID_IShellLink,
                                          (void**)&ipShellLink);
fails with hRes being returned 0x800401f0
 
Andrew

GeneralRe: problemmemberIgor Vigdorchik30 Jun '04 - 3:21 
This error means 'CoInitialize has not been called'.
You need to call CoInitialize() to initialize COM somewhere before you call this function (better to do it in main()).
 
Igor.
GeneralRe: problemmemberMister Transistor2 Jul '04 - 0:57 
Igor,
thanks - I tried to find that error message but failed. Since I am using VC6 I added the call CoInitialize(NULL) to InitInstance (there is no 'main' in a Windows program).
 
My app now works, although there is a minor feature - the lnk path that I pass uses forward slash to separate directories but ResolveShortcut returns backslash separated ones.
 
Also, Microsoft state that new applications should use CoInitializeEx, however I cannot get this to compile, using the header they specify...
see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c_36qt.asp
 
cheers
Andrew
GeneralRe: problemmemberIgor Vigdorchik2 Jul '04 - 4:32 
Mister Transistor wrote:
I tried to find that error message but failed
 
Use Error Lookup utility from VC6 Tools menu.
 
Mister Transistor wrote:
there is no 'main' in a Windows program
 
Sorry, but there is always a main() (sometimes hidden) in the Windows program Smile | :) .
 
Mister Transistor wrote:
Microsoft state that new applications should use CoInitializeEx
 
CoInitialize() will do.
 
Igor.

GeneralThankssussbasudevc7 Apr '04 - 3:55 
Thanks for the article
Unless it's because I haven't searched enough, I haven't found a command line shortcut creation tool for XP. This should do it.
If it works could I put the executable on my website?
 
Basu
 
b a s u d e v a t g n s b i o t e c h d o t c o m
 
bman
GeneralRe: ThanksmemberIgor Vigdorchik10 Apr '04 - 2:36 
Sure.
GeneralMissing Directorymemberbruno leclerc23 Mar '04 - 23:32 
Hi,
When I want to create a shortcut in a missing directory,
the shortcut is not created, but no error is returned ?
Why ?
Thanks
GeneralRe: Missing Directorymemberronyy724 Mar '04 - 14:37 
It may have been created under an unexpected path. It happened to me when my original path > MAX_PATH it got truncated and was created somewhere else.
GeneralRe: Missing DirectorymemberIgor Vigdorchik24 Mar '04 - 15:50 
I just tested it, a shortcut was created but it's target property was pointing to an non-existing folder (or file). It's an expected behaviour, since IShellLink has no way of knowing if a target exists or not.
But when it tries to resolve it then if it can not find a target it'll display a prompting dialog. To suppress the dialog box, you need to set the SLR_NO_UI flag.
 
Igor.
Generalfile name &gt; MAX_PATHmemberronyy717 Mar '04 - 13:09 
Is there a way to create a shortcut for file name > than MAX_PATH using the UNC convention? i.e. \\?\UNC\....
QuestionWhat to includemember--.-10 Feb '04 - 15:38 
If you didn't start with a ready-made project for a Windows executable you'll want these includes:
 
#include <Windows.h>
#include <atlbase.h>
#include <ShlObj.h>

AnswerRe: What to includesussRivael11 May '04 - 0:00 
You might also need to include this in your source code before any OLE operations:
hRes = CoInitialize(NULL);
 

 
mik
Generalget info from MSOffice shortcutmemberSergey K3 Feb '04 - 5:42 
How to obtain a correct path to an executed file for lnk-file of MSOffice 2002 (for example Microsoft Word.lnk in main menu or on Desktop).
I try it to make using IShellLink::GetPath.
I get a path like C:\WINDOWS\Installer\{91110419-6000-11D3-8CFE-0050048383C9}\wordicon.exe.
If to see this file in a binary mode, the file contains this information and the shortcut works correctly.

GeneralRe: get info from MSOffice shortcutmemberIgor Vigdorchik3 Feb '04 - 13:43 
Did you use ResolveShortcut() function from the article?
GeneralRe: get info from MSOffice shortcutmemberSergey K3 Feb '04 - 19:53 
Yes, I used this function. The functions offered by you worked correctly for standard shortcuts.
But this function is not universal. In addition I use interface IShellLinkDataList for getting the extra information. Using IShellLinkDataList:GetFlag I obtain a flag with enabled bit SLDF_HAS_DARWINID (The link is a special Windows ® Installer link.) and disabled bit SLDF_HAS_LINK_INFO.
 
How to get information from the "special Windows ® Installer link"?
(Such shortcuts create many programs and including MSOffice)
GeneralRe: get info from MSOffice shortcutmemberIgor Vigdorchik4 Feb '04 - 13:47 
Interesting...
Can you tell me what kind of shortcuts you are trying to resolve, i.e. MS Word document shortcut or MS Word exe shortcut?
I'll try to look into it, though can not promise anything (unfortunately I do not have much free time right now - too much going on at work).
 
Igor.
GeneralRe: get info from MSOffice shortcutmemberSergey K4 Feb '04 - 20:19 
Can you tell me what kind of shortcuts you are trying to resolve, i.e. MS Word document shortcut or MS Word exe shortcut?
 
Yes, I used shortcuts of MSOffice (Word, Excel, Access) in the main menu of programs (or copy on Desktop).
 
I'll try to look into it, though can not promise anything (unfortunately I do not have much free time right now - too much going on at work).
 
I understand you. I have the same problems Smile | :) .
Thanks for your participation and your goodwill. (Sorry for my bad English.)
 
The solution of my problem looks as follows.

#include
#include
#include
#define _WIN32_MSI 110
#include
 
#pragma comment(lib, "ShlWApi")
#pragma comment(lib, "msi")
 
#define RFLAGS (SLR_INVOKE_MSI | SLR_NOLINKINFO | SLR_NO_UI | SLR_NOUPDATE | SLR_NOTRACK)
 
BOOL _stdcall GetShortcutTarget(IN CONST LPCTSTR ptszLinkPathSpec,
OUT LPTSTR ptszTargetPathSpec, IN CONST UINT cch)
{
BOOL bRet = FALSE;
if (ptszLinkPathSpec && ptszTargetPathSpec && cch &&
!IsBadStringPtr(ptszLinkPathSpec, MAX_PATH) &&
!IsBadWritePtr(ptszTargetPathSpec, cch) &&
PathFileExists(ptszLinkPathSpec))
{
TCHAR tszComponentCode[MAX_FEATURE_CHARS+1];
TCHAR tszProductCode[MAX_FEATURE_CHARS+1];
ptszTargetPathSpec[0] = _T('\0');
tszComponentCode[0] = _T('\0');
tszProductCode[0] = _T('\0');
 
if (ERROR_SUCCESS == MsiGetShortcutTarget(ptszLinkPathSpec, tszProductCode, NULL,
tszComponentCode))
{
DWORD dw = cch;
bRet = (INSTALLSTATE_LOCAL == MsiGetComponentPath(tszProductCode, tszComponentCode,
ptszTargetPathSpec, &dw));
}
else
{
if (SUCCEEDED(CoInitialize(NULL)))
{
CComPtrpiLink;
if (SUCCEEDED(piLink.CoCreateInstance(CLSID_ShellLink)))
{
CComQIPtrpiFile(piLink);
if (piFile)
{
CComBSTR bstrPath = ptszLinkPathSpec;
if (SUCCEEDED(piFile->Load(bstrPath, 0)))
{
if (SUCCEEDED(piLink->Resolve(NULL, RFLAGS)))
{
bRet = (SUCCEEDED(piLink->GetPath(ptszTargetPathSpec, cch, NULL,
SLGP_SHORTPATH)));
}
}
}
}
CoUninitialize();
}
}
bRet = (bRet && PathFileExists(ptszTargetPathSpec));
}
return bRet;
}

 

 
Best regards,
Sergey
GeneralRe: get info from MSOffice shortcutmemberShaun Harrington28 Jun '06 - 14:27 
I did... I get the same thing he does. For the link...
 
+ lpstrLnkFile 0x003a4270 "C:\Documents and Settings\All Users\Start Menu\Open Office Document.lnk"
 
I get...

+ buffer 0x0013e3c8 "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\misc.exe" wchar_t [261]
 
back from your fuction... when I send it with the args and working directory to ShellExec() I don't get the same response as I do when I click on the shortcut.
 
Shaun Harrington
shaun@planetharrington.com
www.planetharrington.com
GeneralRe: get info from MSOffice shortcut [modified]memberShaun Harrington28 Jun '06 - 15:12 
So then I added the second attempt... the GetShortcutTarget() function and it works on MSI style links... but I have a link it doesn't work on... the "Program Compatibility Wizard" found under the "Accessories" sub menu. Any ideas?
 
Shaun Harrington
shaun@planetharrington.com
www.planetharrington.com
 
-- modified at 21:15 Wednesday 28th June, 2006
GeneralRe: get info from MSOffice shortcutmemberShaun Harrington28 Jun '06 - 15:15 
The shortcut when view via the properties page reads "Target type: hcp://system/compatctr/compatmode.htm... the code example here resolves the path to an empty string.
 
Shaun Harrington
shaun@planetharrington.com
www.planetharrington.com
GeneralRe: get info from MSOffice shortcutmemberIgor Vigdorchik28 Jun '06 - 16:50 
Did you try this code[^]?
GeneralRe: get info from MSOffice shortcutmemberShaun Harrington30 Jun '06 - 4:07 
No, I haven't. I'll give it a shot later today.
 
Thanks for the lead!
 
Shaun Harrington
shaun@planetharrington.com
www.planetharrington.com
GeneralRe: get info from MSOffice shortcutmemberIgor Vigdorchik6 Jul '06 - 11:14 
Shaun,
check this article[^] out. Could be useful.
GeneralRe: get info from MSOffice shortcutmemberShaun Harrington20 Jul '06 - 23:46 
Thanks for the lead... still no luck though.
 
I am focused on the IShellLinkDataList interface right now... seems like it is the right interface to get more data from but so far I have not been able to get any data blocks from it! I use ->GetFlags() and that works but when I call CopyDataBlock the pointer is always null no matter what SIG I use.
 
Shaun Harrington
shaun@planetharrington.com
www.planetharrington.com
GeneralRe: get info from MSOffice shortcutmemberBillJam1112 Jul '06 - 6:04 
I can see a problem to but I get "C:\WINDOWS\Installer\{27B3563C-561C-4924-8C0E-EA102264873F}\DHCPMgr.Ico"
 
There is an article that tells what to do but I couldn't get it to work either:
http://www.eggheadcafe.com/ng/microsoft.public.win32.programmer.ole/post313974.asp
 
BillJam11

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 7 Oct 2003
Article Copyright 2003 by Igor Vigdorchik
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid