Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing object from C DLL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00580542
Message ID:
00583153
Vues:
41
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)	&& ssfDESKTOP
>
>For Each item in oFolder.Items
>	If item.IsLink
>		? item.Path		&& Path to link in Desktop
>		oSL = item.GetLink	&& ShellLinkObject
>		? oSL.Path		&& Link's path
>		? oSL.WorkingDirectory	&& Link's working directory
>	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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform