Vb.net 如何创建用于注册文件的exe
所以基本上,我目前正在做的一个项目是使用一个旧的游戏引擎,它不再有任何支持,为了玩游戏,你需要注册一些DLL。现在,该引擎附带了一个RegisterFiles.exe,它将自动为您执行此操作,但问题是因为该引擎太旧了,可执行文件无法在64位计算机上运行(至少我猜是这样的) 我希望制作一个非常简单的可执行文件,可以注册大约3-4个DLL/OCX。我知道这是可能的,因为旧的RegisterFilex.exe程序使用32位操作系统来实现这一点。我的计算机上安装了VisualStudio,但我没有太多使用它。我学得很快,所以我相信如果我被推向正确的方向,我最终会找到答案的 谢谢你们的帮助!如果有比创建exe更简单的选择,我想听听建议!谢谢 我建议使用启动regsvr32.exe并以静默方式注册这些组件。Vb.net 如何创建用于注册文件的exe,vb.net,visual-studio,Vb.net,Visual Studio,所以基本上,我目前正在做的一个项目是使用一个旧的游戏引擎,它不再有任何支持,为了玩游戏,你需要注册一些DLL。现在,该引擎附带了一个RegisterFiles.exe,它将自动为您执行此操作,但问题是因为该引擎太旧了,可执行文件无法在64位计算机上运行(至少我猜是这样的) 我希望制作一个非常简单的可执行文件,可以注册大约3-4个DLL/OCX。我知道这是可能的,因为旧的RegisterFilex.exe程序使用32位操作系统来实现这一点。我的计算机上安装了VisualStudio,但我没有太多使
我假设它们是32位
.dll
和/或.ocx
组件,因此这里使用\SysWOW64\regsvr32
.exe。由于regsvr32
是通过/s
开关启动的,因此它不会显示任何信息对话框窗口。进程本身是在无窗口和隐藏的情况下启动的。Public Class RegComponent
Public Path As String
Public IsRegistred As Boolean
End Class
Private RegComponentsList As List(Of RegComponent)
Public Sub RegisterComponents()
RegComponentsList = New List(Of RegComponent)
Dim RegSvr32 As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows),
"SysWOW64", "regsvr32.exe")
RegComponentsList.Add(New RegComponent With {.Path = "[Component1Path]", .IsRegistred = False})
RegComponentsList.Add(New RegComponent With {.Path = "[Component2Path]", .IsRegistred = False})
RegComponentsList.Add(New RegComponent With {.Path = "[ComponentNPath]", .IsRegistred = False})
For Each RegComp As RegComponent In RegComponentsList
RegComp.IsRegistred = RegSvr32RegisterComponent(RegComp.Path, RegSvr32)
Next
End Sub
Public Function RegSvr32RegisterComponent(ByVal ComponentPath As String, RegSvr32Path As String) As Boolean
Dim ProcessExitCode As Boolean = False
Dim psInfo As ProcessStartInfo = New ProcessStartInfo
psInfo.CreateNoWindow = True
psInfo.UseShellExecute = False
psInfo.FileName = RegSvr32Path
psInfo.Arguments = "/s " + ComponentPath
psInfo.WindowStyle = ProcessWindowStyle.Hidden
Dim _Process As Process = New Process() With {.StartInfo = psInfo,
.EnableRaisingEvents = True,
.SynchronizingObject = Me}
_Process.Start()
'Add an event handler for the Exited event
AddHandler _Process.Exited,
Sub(source, e)
ProcessExitCode = (_Process.ExitCode = 0)
Console.WriteLine("This process has exited. Code: {0}", ProcessExitCode)
End Sub
_Process.WaitForExit()
_Process.Dispose()
Return ProcessExitCode
End Function
VBA!=NET。VBA用于Excel、Word等批处理文件,该文件运行regsvr.exe的次数是否足够?