Visual C++ - 使用.net终止进程
我想使用 Visual C++ 杀死一个进程,就像使用 C# 一样简单:
foreach(Process process in Process.GetProcessesByName("ComponentEnvironmentServer"))
{
process.Kill();
process.WaitForExit();
}
我在网上看到了一些示例,但它们比上面简单得多(我猜是跨平台的)。我对MSVC++和.Net之间的关系很困惑;我认为 .Net 平台的全部原因是为了让事情变得更简单?即能够将上述代码传输到任何.Net 语言?
I want to be kill a process using Visual C++ as easy as the C# way:
foreach(Process process in Process.GetProcessesByName("ComponentEnvironmentServer"))
{
process.Kill();
process.WaitForExit();
}
I've seen some examples on the net but they're a lot less simpler than above (cross-platform I guess). I'm very confused about the relationship between MSVC++ and .Net; I thought the whole reason of the .Net platform was to make things simpler? i.e. to be able to transfer the above code to any .Net language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在托管 C++ 中,这将是:
.NET 允许您使用相同的库,无论您编写 C#、VB.NET 还是托管 C++。
对于本机 C++,代码有所不同,因为您无法访问 .NET 库。
In managed C++ that would be:
.NET allows you to use the same libraries whether you write C#, VB.NET or Managed C++.
For native C++ the code is different as you cant access the .NET libraries.