IShortCut.Save -> does nothing?

delphi package - easy access to shell apis
Post Reply
Niki911
Posts: 12
Joined: Thu Jun 10, 2004 4:06 pm

IShortCut.Save -> does nothing?

Post by Niki911 »

Hi,

I tried and tried and tried - but IShortCut.Save does not seem to save any changes to an existing LNK-File ? :(

I am reading the LNK-File (which IShortCut does correctly) and can access all data like params, path etc.
Everything seems fine with that.
But if I change the IShortCut.Path to a new EXE and call SAVE - the LNK-File will not be changed at all....
(even with the TRYTORESOLVE-Param set to false)

Any ideas on that?

Niki
madshi
Site Admin
Posts: 10339
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Can you please give me a piece of code which fails? It seems to work for me.
Niki911
Posts: 12
Joined: Thu Jun 10, 2004 4:06 pm

Post by Niki911 »

// I have tested/used this ONLY on Shortcuts in Startmenu/Autostart
// So please set filename to ANY Shortcut in that directory...

Link: IShortCut;
Filename: String;
Link:=LoadShortCut(filename);
Link.Path:='c:\windows\notepad.exe'; // for testing... makes no sense I know
Link.Save(Link.ShortCutFileName,false);

This SHOULD set the Shortcut-Target to the Notepad (or not?).
But it does nothing - the shortcut will be unchanged after this...

I am running WindowsXP (Pro with SP1) and using Delphi6Pro.

Niki
madshi
Site Admin
Posts: 10339
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Sorry for the delay, was on journey.

I've tried your code and it works just fine here on my XP. Could you please check whether the shortcut is valid after loading? ("if Link.IsValid then")
Post Reply