obsidian/笔记文件/2.笔记/GetCurrentProcessId.md

70 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2025-03-26 00:02:56 +08:00
#qt
# GetCurrentProcessId 函数 (processthreadsapi.h)
检索调用进程的进程标识符。
[](https://learn.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid#syntax)
## 语法
``` cpp
DWORD GetCurrentProcessId();
```
## 返回值
返回值是调用进程的进程标识符。
[](https://learn.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid#remarks)
## 注解
在进程终止之前,进程标识符将在整个系统中唯一标识进程。
[](https://learn.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid#requirements)
## 要求
展开表
要求
**最低受支持的客户端**
Windows XP [桌面应用 | UWP 应用]
**最低受支持的服务器**
Windows Server 2003 [桌面应用 | UWP 应用]
**目标平台**
Windows
**标头**
processthreadsapi.h (包括 Windows Server 2003 上的 Windows.h、Windows Vista、Windows 7、Windows Server 2008 Windows Server 2008 R2)
**Library**
Kernel32.lib
**DLL**
Kernel32.dll
[](https://learn.microsoft.com/zh-cn/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid#see-also)
## 另请参阅
[GetCurrentProcess](https://learn.microsoft.com/zh-cn/windows/desktop/api/processthreadsapi/nf-processthreadsapi-getcurrentprocess)
[OpenProcess](https://learn.microsoft.com/zh-cn/windows/desktop/api/processthreadsapi/nf-processthreadsapi-openprocess)
[进程和线程函数](https://learn.microsoft.com/zh-cn/windows/desktop/ProcThread/process-and-thread-functions)
[进程](https://learn.microsoft.com/zh-cn/windows/desktop/ProcThread/child-processes)