WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Shortcut Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Shortcuts to Folders Not Appearing and
Shortcut Not Changing with ShortcutEdit

Keywords:  shortcut shortcutmake shortcutedit refresh start menu update

Question:

When I use ShortCutMake() and specify a folder as the target, the shortcut is created, but it does not show up in the Start menu until I restart. When I create a shortcut to an EXE file, however, it appears in the Start menu without a restart.

Does anybody know why this happens? Can you tell me how to make the folder shortcuts appear without a restart?

Answer:

Try something like:

mydir = strcat(ShortCutDir("Start Menu"),"Programs\WinBatch")
bb=BinaryAlloc(2048)
BinaryPokeStr(bb,0,mydir)
dll=strcat(DirWindows(1),"shell32.dll")
DllCall(dll, void:"SHChangeNotify", long:4096, long:1, lpbinary:bb, lpbinary:bb)
Binaryfree(bb)
This code will refresh the Start Menu.

Question:

Using ShortcutEdit on several shortcut (.lnk) files to change the target name, changes the files OK. But Win95 still shows the old target in properties (right clicked / properties) and executes the old target if the shortcut is double left clicked. This appears to be only the shortcut(s) that have been previously used in this win95 session. Re-booting clears the problem and all shortcuts reflect the changed .lnk files.

How do I get Win95 to forget the previous shortcuts and re-read the files, short of re-booting?

I tried the suggested code (above) exactly except for the directory name (mydir). My directory is NOT the "start menu", but an entirely independent directory containing 28 shortcut files, (mydir = "C:\lis\Library Information System"). Any of the shortcuts that have been executed previously in this Win95 session continue to show through "properties", and to execute, the previous target, even though the .lnk files are changed (viewed with DIR, TYPE, and a Hex dump program). A re-boot refreshes all shorcuts to the .lnk files' contents, but is highly undesirable in my context. Other shortcuts (that have not been previously executed) are OK in the first place.

Answer:

Lets try avoiding the long path name... I think the Filenameshort will return a short directory name, otherwise substitute the correct short directory name....
;revised code with short path name

mydir = "C:\lis\Library Information System"
myshortdir=FileNameShort(mydir)
bb=BinaryAlloc(2048)
BinaryPokeStr(bb,0,myshortdir)
dllfile=strcat(dirwindows(1),"shell32.dll")
DllCall(dllfile, void:"SHChangeNotify", long:4096, long:1, lpbinary:bb,
lpbinary:bb)
;Message("Debug",BinaryPeekStr(bb,0,200))
BinaryFree(bb) 

Article ID:   W13856
Filename:   Shortcuts to Folders Not Appearing.txt
File Created: 2001:11:07:12:44:24
Last Updated: 2001:11:07:12:44:24