#include <windows.h>
#include <tlhelp32.h>
#include <shellapi.h>
// TODO: 在此添加控件通知处理程序代码
CString str;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hProcessSnap == INVALID_HANDLE_VALUE)
{
printf(" CreateToolhelp32Snapshot调用失败! \n");
}
BOOL bMore = ::Process32First(hProcessSnap, &pe32);
while(bMore)//循环查看所有进程
{
CString ss=pe32.szExeFile;
CString dd=L"StormPlayer.exe";
if(ss==dd)
{
str.Format(L"进程ID号:%u \n\n",pe32.th32ProcessID);
//MessageBox(pe32.szExeFile+str);
str.Format(L"/c ntsd -c q -p %u",pe32.th32ProcessID);
char *p = (LPSTR)(LPCTSTR)str;
ShellExecute(m_hWnd,_T("open"),L"cmd.exe",str,NULL,SW_HIDE); //这个函数比较重要,可以看一下这个函数的msdn
break;
}
bMore = ::Process32Next(hProcessSnap, &pe32);
}
#include <tlhelp32.h>
#include <shellapi.h>
// TODO: 在此添加控件通知处理程序代码
CString str;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hProcessSnap == INVALID_HANDLE_VALUE)
{
printf(" CreateToolhelp32Snapshot调用失败! \n");
}
BOOL bMore = ::Process32First(hProcessSnap, &pe32);
while(bMore)//循环查看所有进程
{
CString ss=pe32.szExeFile;
CString dd=L"StormPlayer.exe";
if(ss==dd)
{
str.Format(L"进程ID号:%u \n\n",pe32.th32ProcessID);
//MessageBox(pe32.szExeFile+str);
str.Format(L"/c ntsd -c q -p %u",pe32.th32ProcessID);
char *p = (LPSTR)(LPCTSTR)str;
ShellExecute(m_hWnd,_T("open"),L"cmd.exe",str,NULL,SW_HIDE); //这个函数比较重要,可以看一下这个函数的msdn
break;
}
bMore = ::Process32Next(hProcessSnap, &pe32);
}