zoukankan      html  css  js  c++  java
  • 列举进程

    xp:

    #include <windows.h>
    #include <tlhelp32.h>

    int SearchProess(const char* name)
    {
    int ret=0;
    HANDLE handle=NULL;
    PROCESSENTRY32 pe32={0};
    do
    {
    handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    if(handle==(HANDLE)-1)break;
    pe32.dwSize=sizeof(PROCESSENTRY32);
    if(!Process32First(handle,&pe32))break;
    do
    {
    if(strcmp(pe32.szExeFile,name)==0)
    {
    ret=1;
    break;
    }
    }
    while(Process32Next(handle,&pe32));
    } while (0);
    if(handle)
    {
    CloseHandle(handle);
    handle=NULL;
    }
    return ret;
    }

    WINCE:

    #include <tlhelp32.h>
    #pragma comment(lib, "Toolhelp.lib ")


    int SearchProess(const TCHAR* name)
    {
    int ret=0;
    HANDLE handle=NULL;
    PROCESSENTRY32 pe32={0};
    do
    {
    handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    if(handle==(HANDLE)-1)break;
    pe32.dwSize=sizeof(PROCESSENTRY32);
    if(!Process32First(handle,&pe32))break;
    do
    {
    if(_tcscmp(pe32.szExeFile,name)==0)
    {
    ret=1;
    break;
    }
    }
    while(Process32Next(handle,&pe32));
    } while (0);
    if(handle)
    {
    CloseToolhelp32Snapshot(handle);
    handle=NULL;
    }
    return ret;
    }

  • 相关阅读:
    hdu 5072 Coprime (容斥)
    洛谷 P1411 树 (树形dp)
    Tr/ee AtCoder
    sys.path
    uname
    sys.platform
    Eclipse Basic
    Eclipse Color Theme
    Pydev
    scons
  • 原文地址:https://www.cnblogs.com/ccmfc/p/2624635.html
Copyright © 2011-2022 走看看