01.
Dim
temp
As
String
= Path.GetPathRoot(Environment.SystemDirectory) &
"temp\"
02.
Dim
osVer
As
Version = Environment.OSVersion.Version
03.
04.
Dim
temCrystalPath
As
String
= temp &
"CRRuntime_64bit_13_0_18.msi"
05.
Call
LoadResourceToDisk(My.Resources.CRRuntime_64bit_13_0_18, temCrystalPath)
06.
07.
08.
Dim
sb
As
New
System.Text.StringBuilder
09.
sb.AppendLine(
"@echo off"
)
10.
sb.AppendLine(
"echo Install Crystal Report..."
)
11.
sb.AppendLine(
"msiexec /i "
""
& temCrystalPath &
""
" /passive"
)
12.
sb.AppendLine(
"echo Done."
)
13.
sb.AppendLine(
"exit"
)
14.
IO.File.WriteAllText(temp &
"sti.bat"
, sb.ToString())
15.
16.
17.
If
osVer.Major < 6
Then
18.
Try
19.
Dim
runbat
As
Process = Process.Start(temp &
"sti.bat"
)
20.
runbat.WaitForExit()
21.
Catch
ex
As
Exception
22.
MsgBox(ex.Message)
23.
End
Try
24.
ElseIf
osVer.Major >= 6
Then
25.
Try
26.
Dim
procInfo
As
New
ProcessStartInfo()
27.
procInfo.UseShellExecute =
True
28.
procInfo.FileName = (temp &
"sti.bat"
)
29.
procInfo.WorkingDirectory =
""
30.
procInfo.Verb =
"runas"
31.
Dim
runbat
As
Process = Process.Start(procInfo)
32.
runbat.WaitForExit()
33.
Catch
ex
As
Exception
34.
MsgBox(ex.Message)
35.
End
Try
36.
End
If
37.
Try
38.
Dim
installCRY
As
System.Diagnostics.Process = System.Diagnostics.Process.Start(temCrystalPath)
39.
installCRY.WaitForExit()
40.
41.
Catch
ex
As
Exception
42.
MsgBox(ex.Message)
43.
End
Try