Vista,C#和Regsvr32 [英] Vista, C#, and Regsvr32

查看:61
本文介绍了Vista,C#和Regsvr32的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我们正在测试和调整我们在Vista上运行的一些软件,但是它确实是因为我们遇到了一个问题我们的程序。


这是我们的代码:


//尝试在云计算模式下注册OCX对象的实验

尝试

{

System.Diagnostics.Process.Start(" regsvr32.exe"," / s \"" +

Environment.CurrentDirectory +" \\myTempLib.ocx \"");

}

catch(Exception exec)

{

....

}


但是,这没有正确注册.. 。 它失败。如果我以管理员身份运行CMD.exe,我只能在Vista中手动执行此操作




现在有不同的方法吗?是否有一个操作系统的调用,我可以通过该操作向用户调出确认对话框以允许我的

程序以某种方式注册该库?


谢谢,


Rob

Hello,

We are testing and tweaking some of our software to run on Vista, but it
turns 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 mode
try
{
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 this
in 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 I
can make that will bring up the confirmation dialog to the user to allow my
program to somehow register this library?

Thanks,

Rob

推荐答案

你的应用要么去必须以管理员身份运行,或模仿

管理员。


-

HTH,


Kevin Spencer

Microsoft MVP

软件编写器
http://unclechutney.blogspot.com

2点之间的最短距离是曲线。

" RobKinney1" < Ro ******** @ discussion.microsoft.com写信息

新闻:9F ******************** ************** @ microsof t.com ...
Your app is either going to have to run as Administrator, or impersonate an
Administrator.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"RobKinney1" <Ro********@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...

你好,


我们正在测试和调整我们的一些软件在Vista上运行,但是它确定我们的一个程序出现了问题。


这是我们的代码:


//尝试在云计算模式下注册OCX对象实验

尝试

{

System.Diagnostics.Process.Start(" regsvr32.exe"," / s \"" +

Environment.CurrentDirectory +" \\\ \\ myTempLib.ocx \"");

}

catch(Exception exec)

{

...

}


但是,这没有正确注册......它失败了。如果我以管理员身份运行CMD.exe,我只能在Vista中手动执行此操作




现在有不同的方法吗?是否有操作系统的调用



可以使用该操作确认对话框以允许

我的

程序以某种方式注册这个库?


谢谢,


Rob

Hello,

We are testing and tweaking some of our software to run on Vista, but it
turns 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 mode
try
{
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 this
in 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
I
can make that will bring up the confirmation dialog to the user to allow
my
program to somehow register this library?

Thanks,

Rob



" RobKinney1" < Ro ******** @ discussion.microsoft.com写信息

新闻:9F ******************** ************** @ microsof t.com ...
"RobKinney1" <Ro********@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...

你好,


我们正在测试和调整我们的一些软件在Vista上运行,但是它确定我们的一个程序出现了问题。


这是我们的代码:


//尝试在云计算模式下注册OCX对象实验

尝试

{

System.Diagnostics.Process.Start(" regsvr32.exe"," / s \"" +

Environment.CurrentDirectory +" \\\ \\ myTempLib.ocx \"");

}

catch(Exception exec)

{

...

}


但是,这没有正确注册......它失败了。如果我以管理员身份运行CMD.exe,我只能在Vista中手动执行此操作




现在有不同的方法吗?是否有一个操作系统的调用,我可以通过该操作向用户调出确认对话框以允许我的

程序以某种方式注册该库?


谢谢,


Rob

Hello,

We are testing and tweaking some of our software to run on Vista, but it
turns 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 mode
try
{
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 this
in 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 I
can make that will bring up the confirmation dialog to the user to allow my
program 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 run
your program from a command prompt that was started with "Run As Administrator", or you have
to 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.aspx
Willy.


优秀威利!谢谢。现在,如果我能用ClickOnce了解如何做到这一点

。这是一个ClickOnce应用程序,并且使用

MageUI创建的清单设置为完全信任(没有requireAdministrator,我可以

见)。我将用更多的清单进行实验,看看我是否可以想出如何设置它。听起来像是一个可能的罪魁祸首。 :〜}


感谢您提供文章的链接。我一直在寻找那种类型的

文件。


Rob


" Willy Denoyette [MVP]"写道:
Excellent Willy! Thank you. Now if only I can figure out how to do this
with ClickOnce. This is a ClickOnce app and the manifests created with
MageUI are set at full trust (there is no requireAdministrator that I can
see). I will experiment some more with manifests and see if I can figure
out how to set this. Sounds like a likely culprit. :~}

Thank you for the link to the article. I have been looking for that type of
document for some time now.

Rob

"Willy Denoyette [MVP]" wrote:

" RobKinney1" < Ro ******** @ discussion.microsoft.com写信息

新闻:9F ******************** ************** @ microsof t.com ...
"RobKinney1" <Ro********@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...

你好,


我们正在测试和调整我们的一些软件在Vista上运行,但是它确定我们的一个程序出现了问题。


这是我们的代码:


//尝试在云计算模式下注册OCX对象实验

尝试

{

System.Diagnostics.Process.Start(" regsvr32.exe"," / s \"" +

Environment.CurrentDirectory +" \\\ \\ myTempLib.ocx \"");

}

catch(Exception exec)

{

...

}


但是,这没有正确注册......它失败了。如果我以管理员身份运行CMD.exe,我只能在Vista中手动执行此操作




现在有不同的方法吗?是否有一个操作系统的调用,我可以通过该操作向用户调出确认对话框以允许我的

程序以某种方式注册该库?


谢谢,


Rob
Hello,

We are testing and tweaking some of our software to run on Vista, but it
turns 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 mode
try
{
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 this
in 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 I
can make that will bring up the confirmation dialog to the user to allow my
program 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 run
your program from a command prompt that was started with "Run As Administrator", or you have
to 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.aspx
Willy.


这篇关于Vista,C#和Regsvr32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆