Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGet process ID and list Pin
Analog1922-Nov-05 20:02
Analog1922-Nov-05 20:02 
AnswerRe: Get process ID and list Pin
ThatsAlok22-Nov-05 23:43
ThatsAlok22-Nov-05 23:43 
GeneralRe: Get process ID and list Pin
Analog1923-Nov-05 0:08
Analog1923-Nov-05 0:08 
GeneralRe: Get process ID and list Pin
ThatsAlok23-Nov-05 0:18
ThatsAlok23-Nov-05 0:18 
GeneralRe: Get process ID and list Pin
Analog1926-Nov-05 4:32
Analog1926-Nov-05 4:32 
GeneralRe: Get process ID and list Pin
ThatsAlok27-Nov-05 16:49
ThatsAlok27-Nov-05 16:49 
GeneralRe: Get process ID and list Pin
Analog1928-Nov-05 18:19
Analog1928-Nov-05 18:19 
GeneralRe: Get process ID and list Pin
ThatsAlok28-Nov-05 20:47
ThatsAlok28-Nov-05 20:47 
cuteanniyan wrote:
Am sorry to bug you. I am an amateur and starter in VC.


Hain don't need to be Sorry... I am too Amateur in VC.

cuteanniyan wrote:
Still i am getting the same linker error. Can i get list of things i need to check.


Anyways, it will be better to use these apis CreateToolhelp32Snapshot(...),Process32First(...) and Process32Next(...), here is code snippet to achieve same. here, m_mapProcesses is type map<CString,DWORD> m_mapProcesses;

HANDLE hProcess;
PROCESSENTRY32 ppEntry;


// Clear Memory
ZeroMemory(&ppEntry,sizeof(ppEntry));
ppEntry.dwSize=sizeof(ppEntry);

// Get SnapShot of All process
hProcess=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);

// Check if we able to get snap shot
if(INVALID_HANDLE_VALUE==hProcess)
    return FALSE;

if(!::Process32First(hProcess,&ppEntry))
{
    CloseToolhelp32Snapshot(hProcess);
    return TRUE;
}

BOOL bTrue=TRUE;

while(bTrue)
{
    //Save the File
    this->m_mapProcesses[ppEntry.szExeFile]=ppEntry.th32ProcessID;

    if(GetLastError()==ERROR_NO_MORE_FILES)
    {
        CloseToolhelp32Snapshot(hProcess);
        return TRUE;
    }

    bTrue=Process32Next(hProcess,&ppEntry);


}


//Close snapshot
CloseToolhelp32Snapshot(hProcess)


"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
QuestionMFC80UD.DLL was not found Pin
Abyss22-Nov-05 19:49
Abyss22-Nov-05 19:49 
AnswerRe: MFC80UD.DLL was not found Pin
Abyss23-Nov-05 8:57
Abyss23-Nov-05 8:57 
QuestionHaving trouble with a namespace and class type collision in C++/C# project Pin
dxben22-Nov-05 19:46
dxben22-Nov-05 19:46 
AnswerRe: Having trouble with a namespace and class type collision in C++/C# project Pin
BadKarma23-Nov-05 2:12
BadKarma23-Nov-05 2:12 
GeneralRe: Having trouble with a namespace and class type collision in C++/C# project Pin
dxben23-Nov-05 6:04
dxben23-Nov-05 6:04 
GeneralRe: Having trouble with a namespace and class type collision in C++/C# project Pin
dxben23-Nov-05 7:48
dxben23-Nov-05 7:48 
QuestionCharacter set that supports all all Language character Pin
anilksingh22-Nov-05 19:35
anilksingh22-Nov-05 19:35 
AnswerRe: Character set that supports all all Language character Pin
ThatsAlok22-Nov-05 23:45
ThatsAlok22-Nov-05 23:45 
QuestionHTTP Cookies ? Pin
Putta_V22-Nov-05 19:05
Putta_V22-Nov-05 19:05 
QuestionJump to a location in floppy Pin
Aqueel A. Mirza22-Nov-05 19:04
Aqueel A. Mirza22-Nov-05 19:04 
AnswerRe: Jump to a location in floppy Pin
kakan22-Nov-05 19:35
professionalkakan22-Nov-05 19:35 
AnswerRe: Jump to a location in floppy Pin
Bob Stanneveld23-Nov-05 6:36
Bob Stanneveld23-Nov-05 6:36 
Questionmindow message of popup menu. Pin
includeh1022-Nov-05 19:02
includeh1022-Nov-05 19:02 
AnswerRe: mindow message of popup menu. Pin
Marc Soleda22-Nov-05 20:35
Marc Soleda22-Nov-05 20:35 
AnswerRe: mindow message of popup menu. Pin
Owner drawn22-Nov-05 22:03
Owner drawn22-Nov-05 22:03 
QuestionMemory Handling Check Pin
Anzy22-Nov-05 18:53
Anzy22-Nov-05 18:53 
Questionusing MSChart in VC++ and its methods Pin
nams_pr22-Nov-05 18:36
nams_pr22-Nov-05 18:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.