如何在C#Windows窗体中使用ID创建自己的进程 [英] How to create our own process using ID in C# Windows Forms

查看:80
本文介绍了如何在C#Windows窗体中使用ID创建自己的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要跟踪我的流程状态。但如果存在许多相同名称的EXE,我就无法区分。区分这一点的唯一方法是使用进程ID。



但这对我的问题不起作用。



所以我的要求是我需要根据Id创建自己的EXE。



如果我的常用EXE是bantd.exe。我需要在该进程名称旁边添加我的ID。



示例bantd123.exe,bantd3455.exe。



有没有办法做到这一点

I need to track my process status. But if many EXE of same name exists I cant differentiate. The only way to differentiate this is using process Id.

But this doesn't work well for my problem.

So my requirement is that I need to create my own EXE depending on Id.

If my common EXE was bantd.exe. I need to add my Id next to that process name.

Example bantd123.exe, bantd3455.exe.

Is there any way to do this

推荐答案

启动流程时无法指定流程ID - 它由系统分配,而不是您的app。



但是当你从应用程序中启动EXE时,你可以使用Process类。 Process类通过 Id属性 [ ^ ]
You can't specify a process id when you start a process - it is assigned by the system, not your app.

But when you start an EXE running from within your application, you do so using the Process class. And the Process class gives you the Process Id of the running application via the Id Property[^]


这篇关于如何在C#Windows窗体中使用ID创建自己的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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