file - VB: Changing shortcut properites -
i have code, task changing .url or .lnk (shortcuts) properties, not seem anything.
imports system.io imports shell32 module module1 sub main() 'references microsoft shell controls , automation. 'http://msdn.microsoft.com/en-us/library/bb776890%28v=vs.85%29.aspx end sub public sub change_shortcut() dim shell shell32.shell dim folder shell32.folder dim folderitem shell32.folderitem dim shortcut shell32.shelllinkobject shell = new shell32.shell folder = shell.namespace("c:\users\grzegop\desktop\xxx") 'shortcut path if not folder nothing folderitem = folder.parsename("o2.url") 'shortcut name if not folderitem nothing shortcut = folderitem.getlink if not shortcut nothing shortcut.path = "www.o2.ie" 'new shortcut address shortcut.save() msgbox("shortcut changed") else msgbox("shortcut link within file not found") end if else msgbox("shortcut file not found") end if else msgbox("desktop folder not found") end if end sub end module
can give me advice going wrong?
thanks.
it's noted here cannot create url shortcut way:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb776891%28v=vs.85%29.aspx
you should instead create xxx.url
file on desktop, writing following lines of text inside of it:
[internetshortcut] url=http://www.o2.ie
windows turn web-site shortcut.
Comments
Post a Comment