Alexander,
Thanks a million. Works great.
>Hello,
>I have found that the only way to create ShellLinkObject via late binding is Shell.Application.Namespace().Items.Item().GetLink for existing shortcut file.
>Here the sample of enumerating all links on desktop:
>
>oShell = CreateObject("Shell.Application")
>oFolder = oShell.NameSpace(0x0)
>
>For Each item in oFolder.Items
> If item.IsLink
> ? item.Path
> oSL = item.GetLink
> ? oSL.Path
> ? oSL.WorkingDirectory
> Endif
>EndFor
>
>Here the sample of creating new shortcut using existing:
>
>oShell = CreateObject("Shell.Application")
>oFolder = oShell.NameSpace("d:\")
>oSL = oFolder.Items.Item("test.lnk").GetLink
>oSL.Path = "d:\decimal.zip"
>oSL.Description = "Description"
>oSL.Save("d:\newlink.lnk")
>
>>Here is C declaration:
>>hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
>>IID_IShellLink, (PVOID *)&psl);
>>...
>>psl->Release()
>>
>>Here is VFP attempt of declaration:
>>
>>declare integer CoCreateInstance in Ole32.dll as CoCreateInstance;
>>string CLSID, string ParentStruct, integer Context,string IID, integer @iShellLink
>>
>>lnRes = CoCreateInstance(cCLSID, oNULL, CLSCTX_INPROC_SERVER,;
>>cIID, @oIShellLink)
>>...
>>oIShellLink.Release()
>>
>>However, VFP can not access object this way. What would be alternative suggestions?
If it's not broken, fix it until it is.
My Blog