I tried your code, actually the following code which is equivalent:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Filename AsString = "C:\Test.zip"
Dim B() AsByte = {Asc("P"), Asc("K"), 5, 6}ReDimPreserve B(21)My.Computer.FileSystem.WriteAllBytes(Filename, B, False)Dim Shl AsNew Shell32.ShellDim Input AsString = "C:\Windows\Fonts"Shl.NameSpace(Filename).CopyHere(Input, 256)
EndSub
on XP and on Vista. The program ran fine in debug mode in VB2005 on XP and in debug mode in VB2008 Express on Vista.
I copied the XP debug folder to the system drive of both machines. It ran without problem on XP. It wouldn't run on Vista due to lack of security permissions.
I then copied the Vista debug folder to the system drive of both machines. It ran without problem on Vista. It wouldn't run on XP. It gave the same error as you describe in your post. I tried replacing the Interop.Shell32.dll with the one from the XP debug folder. The error was different but it still wouldn't run.
I can see no reason why your code will not run on Vista or XP if your app has the correct permissions. There is no problem with the code.
Edit:
I published the code on the XP machine. It installs and runs OK on both Vista and XP