Announcement

Collapse
No announcement yet.

IShellLink

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lance Edmonds
    replied
    a loosely related thread that could be of interest:


    ------------------
    lance
    powerbasic support
    mailto:[email protected][email protected]</a>

    Leave a comment:


  • Semen Matusovski
    replied
    Thanks, Florent. Hope, that your code helps.
    I found in MSDN short sample
    Code:
    // CreateLink - uses the shell's IShellLink and IPersistFile interfaces 
    //   to create and store a shortcut to the specified object. 
    // Returns the result of calling the member functions of the interfaces. 
    // lpszPathObj - address of a buffer containing the path of the object. 
    // lpszPathLink - address of a buffer containing the path where the 
    //   shell link is to be stored. 
    // lpszDesc - address of a buffer containing the description of the 
    //   shell link. 
     
    HRESULT CreateLink(LPCSTR lpszPathObj, 
        LPCSTR lpszPathLink, LPCSTR lpszDesc) 
    { 
        HRESULT hres; 
        IShellLink* psl; 
     
        // Get a pointer to the IShellLink interface. 
        hres = CoCreateInstance(CLSID_ShellLink, NULL, 
            CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *) &psl); 
        if (SUCCEEDED(hres)) { 
            IPersistFile* ppf; 
     
            // Set the path to the shortcut target and add the 
            // description. 
            psl->SetPath(lpszPathObj); 
            psl->SetDescription(lpszDesc); 
     
           // Query IShellLink for the IPersistFile interface for saving the 
           // shortcut in persistent storage. 
            hres = psl->QueryInterface(&IID_IPersistFile, 
                &ppf); 
     
            if (SUCCEEDED(hres)) { 
                WCHAR wsz[MAX_PATH]; 
     
                // Ensure that the string is Unicode. 
                MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, 
                    wsz, MAX_PATH); 
     
                // Save the link by calling IPersistFile::Save. 
                hres = ppf->Save(wsz, TRUE); 
                ppf->Release(); 
            } 
            psl->Release(); 
        } 
        return hres; 
    }
    and want to test "natural" API without "workarounds"

    ------------------

    Leave a comment:


  • Florent Heyworth
    replied
    Hi Semen

    some time ago I wrote a PB COM IShell wrapper (not using Philippe Monteil's excellent JACOMPB products) - it's a bit rough but it works and there's also an included VB test file to test the dll with.

    You can find the package in zip form at:
    http://www.radbit.com/code/ishell.zip

    Cheers

    Florent

    ------------------

    Leave a comment:


  • Semen Matusovski
    started a topic IShellLink

    IShellLink

    Guys --
    Somebody have a sample of iShellLink' usage in PB or/and necessary INC for COM functions and constansts ?
    Thanks
Working...
X