无法转换类型为" system .__ comObject"的COM对象接口类型' shell32.shell'

时间:2017-09-12 04:05:38

标签: vb.net visual-studio visual-studio-2015 shell32 shell32.dll

我在win 7和xp中运行我的项目,但是有一条错误消息,在这个项目中我使用shell32.shell来复制和提取自动exe文件, shell32.shell在Windows 7和XP中不起作用吗? 如果可以,请建议sheell32.shell可以运行

Dim sc As New Shell32.Shell()
Dim pathExeOnServer As String = "\\server\UpdateProgram\"

Try
                If (Not System.IO.Directory.Exists(Path.Combine(Application.StartupPath() & "\RS_Application"))) Then
                    Directory.CreateDirectory(Path.Combine(Application.StartupPath() & "\RS_Application"))
                Else
                    'DO NOTHING
                End If

                Me.Cursor = Cursors.WaitCursor
                File.Copy(Path.Combine(pathExeOnServer, fileName & ".zip"), Path.Combine(Application.StartupPath() & "\RS_Application", fileName & ".zip"), True)
                System.IO.File.Delete(Application.StartupPath() & "\RS_Application\" & fileName & ".exe")
                Dim output As Shell32.Folder = sc.NameSpace(Application.StartupPath() & "\RS_Application")
                Dim input As Shell32.Folder = sc.NameSpace(Application.StartupPath() & "\RS_Application\" & fileName & ".zip")
                output.CopyHere(input.Items, 4)
                Me.Cursor = Cursors.Arrow
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical)
            End Try

error message

0 个答案:

没有答案