Windows shortcut errors stop xojo processing

Dont you just need to turn off system error handling temporarily then ?
See SetErrorMode

Basically turn things off, check the shortcut, turn them back on

I know how to work around the issue using Shell Links but if he has MBS then I won’t have to spend the time working on the demo, so I always ask :slight_smile:

I tried turning off system error handling – I found that suggestion in another post – but still got the error.

@JulianS yes I have MBS. :slight_smile:

Cool!

Here you go:

[code]Dim cf As FolderItem
Dim item As FolderItem
cf = GetFolderItem(“C:\Users\julian\Desktop\ew folder”)

Dim c, i As Integer
c = cf.Count
system.DebugLog(“files found=” + str(c))

For i = 1 To c

'we use this so we dont try to resolve the shortcut and throw up a dialog if the target is missing
item = cf.trueItem(i)

If item.Alias Then
'do alias/shortcut stuff here
Dim w As WindowsShortCutMBS
w = New WindowsShortCutMBS
w.Location = item.NativePath

If w.ResolveShortCut(True, True) Then '1st true disables popup, 2nd true cancels search
  system.DebugLog("target=" + w.target)
End If

Else
item = cf.item(i)
End If

system.DebugLog(“is “”” + item.name + “”" an alias? " + str(item.Alias))

Next[/code]

If anyone finds this thread and doesn’t have MBS, let me know and I’ll whip up a COM call for IShellLinkW::Resolve where SLR_NO_UI is the key to not showing the popup.

I’ve put a ticket in for a similar issue with Xojo.IO.FolderItem where you can actually ask it not to show the popup but it still does <https://xojo.com/issue/55623>.

I guess I should feature request it to be added to the old framework as well as it shouldn’t be that big of a change.

(Mainly noted above for my own future reference if I need to code this ;))

Working like a charm @JulianS . Like a charm. Thank you so much! :slight_smile: