HWND hWnd = ::FindWindow(NULL, _T("sss.txt - 记事本")); DWORD dwTID=0; DWORD dwPID = NULL; dwTID = ::GetWindowThreadProcessId(hWnd, &dwPID);//获取指定窗口线程ID和进程ID //参数1:窗口句柄HWND //参数2:LPDWORD 保存进程ID //返回值:线程ID CString str; str.Format(_T("%d"), dwPID); AfxMessageBox(str);
标签:GetWindowThreadProcessId,MFC,窗口,线程,str,ID,dwPID From: https://www.cnblogs.com/liming19680104/p/17202227.html