System.IO og IWshRuntimeLibrary har begge en metode der hedder file. så hvis der bare står file ved den ikke hvilken der skal vælges. det kan løses ved at droppe imports IWshRuntimeLibrary og angive IWshRuntimeLibrary.<metodenavn> hvor det er påkrævet.
jeg har rettet lidt i functionen den kan kompile og oprette shortcut: Public Function CreateShortCutOnDesktop(ByVal userID As String, _ ByVal passWord As String) As Boolean Try Dim wShell As New IWshRuntimeLibrary.WshShellClass() Dim DesktopDir As String = _ CType(wShell.SpecialFolders.Item("Desktop"), String) Dim shortCut As IWshRuntimeLibrary.IWshShortcut
' short cut files have a .lnk extension shortCut = CType(wShell.CreateShortcut(DesktopDir & _ "\MyNewShortcut.lnk"), _ IWshRuntimeLibrary.IWshShortcut)
' set the shortcut properties With shortCut .TargetPath = _ System.Reflection.Assembly.GetExecutingAssembly.Location() .WindowStyle = 1 .Description = "Run Typist Summary" .WorkingDirectory = DesktopDir ' the next line gets the first Icon from the executing program .IconLocation = _ System.Reflection.Assembly.GetExecutingAssembly.Location() & _ ", 0" ' the next line sets the userID and passWord into the shortcut ' as arguments ' which will be read from the command line. .Arguments = userID & ", " & passWord .Save() ' save the shortcut file End With Return True Catch ex As System.Exception ' add your error handling here, if any Return False End Try End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.