On Thursday, 22 February 2018 at 13:15:11 UTC, rikki cattermole wrote:

Reminder classes in D are already references, no need for pointers to them.


Thank you,but get the same error.

[D CODE]

        if(lpszLnkFileDir is null) return;
        HRESULT hr;
        IShellLink pLink;
        IPersistFile ppf;

hr = CoCreateInstance(CLSID_ShellLink,NULL, CLSCTX_INPROC_SERVER,IID_IShellLinkA,pLink);//cast(PVOID*)
        
        DisplayInfoWork("CoCreateInstance ");
        if(FAILED(hr))
        {
                DisplayInfoWork("FAILED(hr) ");
                return ;
        }
        DisplayInfoWork("  pLink is "~pLink.to!string);
        DisplayInfoWork("will QueryInterface hr is "~hr.to!string);
        DisplayInfoWork(IID_IPersistFile.to!string);
        hr = pLink.QueryInterface(IID_IPersistFile, ppf);// err <-
        DisplayInfoWork("pLink.QueryInterface ");

-------------------log info--------------
CoCreateInstance
  pLink is 5E9954
will QueryInterface hr is 0
const(GUID)(267, 0, 0, [192, 0, 0, 0, 0, 0, 0, 70])
Access Violation

-----------------------end----------------------------
Thanks.

Reply via email to