Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 What's wrong, or how to do it properly?

$
0
0
Hello once again folks. As I implemented flash objects to my project now it requires the ocx. I am trying to deliver it automatically to save the end user the troubles of downloading it manually and eventually putting it on the wrong place. Here's what I'm trying to accomplish:

Code:

Dim Sysroot As String = Environment.GetEnvironmentVariable("systemroot")
Dim FlashDLL As String = "Flash32_11_5_502_146.ocx"
My.Computer.FileSystem.CreateDirectory(Sysroot / "system32/Macromed/Flash")
System.IO.File.WriteAllBytes(Sysroot / "system32/Macromed/Flash" / FlashDLL, My.Resources.Flash32_11_5_502_146)

Am I at least going on the right direction with this?

Error given:


System.InvalidCastException: Conversion from string "C:\Windows" to type 'Double' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)

Using the fullpath gives me

System.Net.WebException: An exception occurred during a WebClient request. ---> System.UnauthorizedAccessException: Access to the path 'C:\Windows\System32\Macromed\Flash\Flash32_11_5_502_146.ocx' is denied.

The program is being run as administrator.
I guess I will keep doing it the old manual way until I find solution.

Cheers
-George.

Viewing all articles
Browse latest Browse all 27189

Trending Articles