CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Installer/uninstaller issue

    I have a custom installer that places a program's shortcut on a desktop using the following code sequence:
    Code:
    SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOPDIRECTORY, &pidl);
    SHGetPathFromIDList(pidl, path);
    
    CString pPathLinkTo;
    pPathLinkTo = path + LinkName;
    
    //Use 'path' to create a shortcut
    IShellLink* psl;
    CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
        reinterpret_cast<void**>(&psl));
    psl->SetPath(pPathLinkTo);
    
    IPersistFile* ppf;
    psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf));
    ppf->Save(pSaveLinkTo, TRUE);
    
    ppf->Release(); 
    psl->Release();
    I should also say that the installer is running elevated.

    Now, when the uninstaller runs (also elevated) it attempts to delete the shortcut created above using the following code:
    Code:
    SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOPDIRECTORY, &pidl);
    SHGetPathFromIDList(pidl, path);
    
    CString pPathLinkTo;
    pPathLinkTo = path + LinkName;
    
    DeleteFile(pPathLinkTo);
    It succeeds and removes the link from the Admin account's desktop, but what it fails to do is to remove the same shortcut from [another] standard user's desktop on the same system. For some reason the installer creates a copy of the shortcut for the standard user as well.

    How do I make uninstaller remove the shortcut from a standard user's desktop too?
    Last edited by ahmd; September 1st, 2010 at 02:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured