Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing object from C DLL
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00580542
Message ID:
00583153
Views:
37
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
Previous
Reply
Map
View

Click here to load this message in the networking platform