Creating shortcut from desktop

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
 
G

Guest

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.
 
R

Rob S

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top