Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am asked to fix a problem. Given is a program written in C / C++, running as a windows-service under LocalSystem user.

On the desktop is a file First.lnk, stored in C:\Users\Public\Desktop. The link points to D:\Second.url.

When the user logs in the contents of Second.url is:
[InternetShortcut]
URL=


During running the service, the program adds a valid url in the second line.

Then I tried using method SHChangeNotify() with different arguments. But nevertheless, a doubleclick on the First.lnk still shows:

The target "" of this Intenet Shortcut is not valid. Go to the Internet Shortcut property sheet and make sure the target is correct.


What do I have to do, that the link on the desktop recognizes, that to targeted .url-file is updates?

Like said above, after a logout / login everything works fine. But that is no solution.

What I have tried:

I have tried
SHChangeNotify()
both on the First.lnk and Second.url. No way.

As arguments I tried: SHCNE_UPDATEITEM, SHCNE_ATTRIBUTES, SHCNE_UPDATEDIR. As 2nd parameter I used
SHCNF_PATHW
or
SHCNF_PATHW | SHCNF_FLUSH
or
SHCNF_PATHW | SHCNF_FLUSH | SHCNF_NOTIFYRECURSIVE
Posted
Updated 27-Mar-20 4:58am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900