本文介绍了Vista,C#和Regsvr32的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我们正在测试和调整我们在Vista上运行的一些软件,但是它确实是因为我们遇到了一个问题我们的程序。 这是我们的代码: //尝试在云计算模式下注册OCX对象的实验 尝试 { System.Diagnostics.Process.Start(" regsvr32.exe"," / s \"" + Environment.CurrentDirectory +" \\myTempLib.ocx \""); } catch(Exception exec) { .... } 但是,这没有正确注册.. 。 它失败。如果我以管理员身份运行CMD.exe,我只能在Vista中手动执行此操作 。 现在有不同的方法吗?是否有一个操作系统的调用,我可以通过该操作向用户调出确认对话框以允许我的 程序以某种方式注册该库? 谢谢, RobHello,We are testing and tweaking some of our software to run on Vista, but itturns out that we are having problems with one of our programs.Here is our code:// attempt an experiment to register an OCX object in silient modetry{System.Diagnostics.Process.Start("regsvr32.exe", " /s \"" +Environment.CurrentDirectory + "\\myTempLib.ocx\"");}catch (Exception exec){....}However, this is not registering properly... it fails. I can only do thisin Vista manually if I run the CMD.exe as administrator.Is there a different way of doing this now? Is there a call to the OS that Ican make that will bring up the confirmation dialog to the user to allow myprogram to somehow register this library?Thanks,Rob推荐答案 Regsvr32需要管理注册COM组件的权限,因此您需要从以以管理员身份运行命令的命令提示符运行您的程序,或者您需要 来添加应用程序清单到您的应用程此应用程序清单必须设置 " requestedExecutionLevel"可以通过运行mt.exe将应用程序清单添加到程序集中。 有关详细信息,请阅读: http://msdn2.microsoft.com/en-us/library/aa480150。 aspx Willy。Regsvr32 needs "administrative" privileges to register COM components, so you need to runyour program from a command prompt that was started with "Run As Administrator", or you haveto add an application manifest to your application. This application manifest must set the"requestedExecutionLevel" to "requireAdministrator".Application manifests can be added to an assembly by running mt.exe.For more info read this: http://msdn2.microsoft.com/en-us/library/aa480150.aspxWilly. Regsvr32需要管理注册COM组件的权限,因此您需要从以以管理员身份运行命令的命令提示符运行您的程序,或者您需要 来添加应用程序清单到您的应用程此应用程序清单必须设置 " requestedExecutionLevel"可以通过运行mt.exe将应用程序清单添加到程序集中。 有关详细信息,请阅读: http://msdn2.microsoft.com/en-us/library/aa480150。 aspx Willy。Regsvr32 needs "administrative" privileges to register COM components, so you need to runyour program from a command prompt that was started with "Run As Administrator", or you haveto add an application manifest to your application. This application manifest must set the"requestedExecutionLevel" to "requireAdministrator".Application manifests can be added to an assembly by running mt.exe.For more info read this: http://msdn2.microsoft.com/en-us/library/aa480150.aspxWilly. 这篇关于Vista,C#和Regsvr32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-29 00:57