VC++如何根据进程名获取进程ID
2012-04-28
展开全部
原型:
unsigned long WINAPI icePub_getPidByName(char *strProcessName)
输入:strProcessName 进程名
输出:
返回码:进程PID
unsigend long pid;
typedef unsigned long (WINAPI ICEPUB_GETPIDBYNAME)(char *strProcessName);
ICEPUB_GETPIDBYNAME *icePub_getPidByName = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_getPidByName = (ICEPUB_GETPIDBYNAME *)GetProcAddress(hDLLDrv, "icePub_getPidByName");
}
if(icePub_getPidByName)
pid=icePub_getPidByName("QQ.exe");
if(hDLLDrv)
FreeLibrary(hDLLDrv);
unsigned long WINAPI icePub_getPidByName(char *strProcessName)
输入:strProcessName 进程名
输出:
返回码:进程PID
unsigend long pid;
typedef unsigned long (WINAPI ICEPUB_GETPIDBYNAME)(char *strProcessName);
ICEPUB_GETPIDBYNAME *icePub_getPidByName = 0;
HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
if(hDLLDrv)
{
icePub_getPidByName = (ICEPUB_GETPIDBYNAME *)GetProcAddress(hDLLDrv, "icePub_getPidByName");
}
if(icePub_getPidByName)
pid=icePub_getPidByName("QQ.exe");
if(hDLLDrv)
FreeLibrary(hDLLDrv);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询