0

I'm VERY new at VB .NET and have recently downloaded MS Visual Studio Express 2012. I'm trying to design an application to replace a VBScript I created and can't find the answer to Two of the main design phase features I require so I apologize ahead of time for my ignorance.

I'm trying to create an application to edit the configuration parameters of an existing application I support. the configurations are edited in both the Files System and in the Windows Registry.

I'm looking for a way to pass a "/q" or "/quiet" and allow the application to run silently. I have developed the program far enough to edit the options in the form and save them. I can run code (so far only messages displaying the options) from the start configuration button from a "Windows Form Application".

I'm also needing to make sure that when running silently the application does not need UAC elevation. In the original VBScript I need to elevate UAC when editing the Windows Registry.

I know this is a lot to ask for with my current knowledge level. But I'm still in the design stage and trying to learn fast and really need to know if this is even possible before I go too far.

4

1 回答 1

0

如果原始应用程序需要 UAC 提升来编辑注册表,那么新应用程序也需要。访问级别基于每个用户而不是每个应用程序,因此除非您以其他用户身份运行应用程序,否则您的新应用程序将遇到相同的问题。

至于在不显示表单的情况下运行,您需要像这样编辑 Main :

 <STAThread()> _
 Shared Sub Main()
    ' Read the arguments    
    ' Starts the application.
    if (argument == "/q" or argument == "/quiet") then
        ' Edit the other program configurations here
    else
        Application.Run(New Form1())
    End if
 End Sub

您可以调用不显示表单的版本Run(ApplicationContext ),但是在启动消息循环时,您仍然需要某种方式来实际编辑其他程序的配置,也许是为了响应击键。

于 2013-02-09T22:32:37.917 回答