Creating shortcut from desktop

  • Thread starter Thread starter Rob S
  • Start date Start date
R

Rob S

I'm trying to create an application shortcut from a desktop application using
Opennet.Desktop.Communication, however it keeps return an error

Dim rapi As New OpenNETCF.Desktop.Communication.RAPI
rapi.Connect()
rapi.CreateDeviceShortcut("\Windows\Start Menu\Programs\Myapp.lnk",
"\Program Files\Myapp\Myapp.exe")
rapi.Disconnect()

It creates a new file on the device, but when i click it i get an error of
bad file or must be signed. i check the properties of the new file and it is
different than a normal shortcut file. the target type is "file folder"
instead of application. it also does not show up as a shortcut file. am i
doing something incorrect in creating the shortcut or? i am using the latest
version of the opennetcf.desktop.communication dll.

Many thanks
 
My guess is that the spaces in the names are causing the problem - very
likely those in the second parameter. Try enclosing it in single quotes and
see what happens.
 
Thanks Chris, i got it working in the end and it was indeed spaces it didn't
like.

This works:

r.CreateDeviceShortcut("\\Windows\\Start Menu\\Programs\\SAMS.lnk",
"\"\\Program Files\\SAMS PDA\\SAMS PDA.exe\"");

Thanks agai
 
Back
Top