tommy

It's hard to tell the world we live in is either a reality or a dream
posts - 52, comments - 17, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

this is the content:
#include <Tlhelp32.h>

//取得内存中的实例数
int GetMemoryProcessCount(LPCSTR peFileName)
{
    
int result = 0;

    HANDLE hSnapshot;
    PROCESSENTRY32 pe;
    pe.dwSize
=sizeof(pe);
    BOOL blExist
=FALSE;
    
char sPath[MAX_PATH] = "";
    strcpy(sPath,peFileName);

    size_t len 
= strlen(sPath);    
    hSnapshot
=::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    
if(hSnapshot<0goto L1;

    
if(::Process32First(hSnapshot,&pe)==FALSE)
    
{
        ::CloseHandle(hSnapshot); 
goto L1;
    }

    
if(_strnicmp(sPath,pe.szExeFile,len)==0)
    
{        
        
++ result;
    }


    
while(::Process32Next(hSnapshot,&pe))
    
{
        
if(_strnicmp(sPath,pe.szExeFile,len)==0)
        
{
            
++ result;
        }
 
    }


L1: 
    ::CloseHandle(hSnapshot);
    
return result;
}

posted @ 2005-10-22 10:47 Tommy Liang 阅读(417) | 评论 (0)编辑 收藏

开张大吉,我欲技艺精进,却见那C++技术,实为系统知识,左至汇编,右至Java,游离其中。计划几何,皆为饭所困,未来1年,希望游戏技术入门,细细辨之,C++技术,要么嵌入式,要么游戏开发,游戏开发,我之梦想也。各位高手,多多关照之

posted @ 2005-10-11 22:25 Tommy Liang 阅读(117) | 评论 (0)编辑 收藏

仅列出标题
共6页: 1 2 3 4 5 6