How to use IShellLink ? (...david ?) 
Author Message
 How to use IShellLink ? (...david ?)

Hi,
First a big thanx to David who gave me the IShellLink
solution.
The new problem is that I am unable to use it and I have
no idea why!
I think I do correctly the first part of the job (thx to
MSDN) but when I try to call the Load operation, it fails
every time. Does anybody have an idea ?

Here is my code:

{
  LPSTR lpszfln = "e:\\a.lnk";

  HRESULT hres;
  IShellLink *psl = NULL;
  IPersistFile *ppf = NULL;

  LPSTR lpszPath = NULL;
  LPSTR lpszDescription = NULL;

  WORD wfd[MAX_PATH];

  hres = CoCreateInstance(  CLSID_ShellLink, NULL,
                           CLSCTX_INPROC_SERVER,
                           IID_IShellLink,
                           (LPVOID*)&psl);

   if(SUCCEEDED(hres))
   {  
     hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)
&ppf);

     //Load call always fails, even the file (c:\a.lnk")
exists
     hres = ppf->Load(LPCOLESTR(lpszfln), STGM_READ );
     if (SUCCEEDED(hres))
     {
        hres = psl->Resolve(m_hWnd, SLR_ANY_MATCH |
SLR_NO_UI);
        if (SUCCEEDED(hres))
        {
          //AND THEN ?? what to do to get the path,
working dir and arguments
        }

     }
   }

Quote:
}



Sat, 03 Jul 2004 21:53:38 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Using David Petersons Collection wizard

2. Using IShellLink

3. Shortcut using IShellLink

4. How to create a Shortcut using IShellLinks ?

5. Modifying Short Cuts Using IShellLink?

6. Workout C by David Himmel - I need floppy disk

7. To Dann , David and Duncan

8. _Using_C_on_the_UNIX_System_, by David A. Curry

9. Book on C by David Himmel

10. For David Lowndes- RE: Date Related Query

11. David S. Platt

 

 
Powered by phpBB® Forum Software