根据进程名获取PID - DmaGetPidFromName
函数简介
根据进程名获取进程 ID (PID),支持部分匹配。(高级版功能,普通版无法使用)
接口名称
DmaGetPidFromName
DLL调用
int32_t OLA_CALL_TYPE DmaGetPidFromName(int64_t instance, int64_t deviceId, OLA_STRING_INPUT processName);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| deviceId | 长整数型 | 设备ID |
| processName | 字符串 | 进程名,支持部分匹配,不区分大小写 |
示例
int32_t pid = DmaGetPidFromName(instance, deviceId, "notepad.exe");
if (pid > 0) {
printf("进程 PID: %d\n", pid);
}
返回值
整数型:成功返回 PID (>0),失败返回 0。
