Virtual Developer Workshop: Containerized Development with Docker

The ProcessViewer is a very simple console application process viewer that displays the information about the processes that are currently executing in the memory. Here's an example of what the running applications displays.

While the overall scope of the application may be narrow, the code does illustrate how to use of Tool Help Library provided by Microsoft in order to obtain vital information about running processes. Below is the salient code for this purpose.

Note that specifically the application makes use of the process functions Process32First and Process32Next to find all the running processes in the system.
void CProcessViewerDlg::ShowProcessData()
 // Get the snapshot of the system

 hSnapShot=CreateToolhelp32Snapshot(TH32CS_SNAPALL, NULL);


 pEntry.dwSize = sizeof(pEntry);

 //Buffer for Process Info
 char szProcessInfo[255];

 /Get first process
 Process32First(hSnapShot, &pEntry);

 //Iterate thru all processes

  BOOL hRes=Process32Next (hSnapShot,&pEntry);


  sprintf(szProcessInfo,"%d",pEntry.th32ProcessID );


  sprintf(szProcessInfo,"%d",pEntry.cntThreads );


  sprintf(szProcessInfo,"%d",pEntry.pcPriClassBase );


Download demo source and demo - 14 Kb


  • this error is coming while Building project

    Posted by madhusudhanv on 03/07/2006 01:25pm

    The compilation is done successfully , but building this error is coming ??? --------------------Configuration: ProcessViewer - Win32 Debug-------------------- Compiling... TaskManagerEx.cpp c:\process\taskmanager1\taskmanagerex\taskmanagerex\taskmanagerex.cpp(6) : fatal error C1083: Cannot open include file: 'LoadDll.h': No such file or directory Error executing cl.exe. ProcessViewer.exe - 1 error(s), 0 warning(s)

  • How can I find out...

    Posted by Legacy on 02/23/2004 08:00am

    Originally posted by: Punga

    If I have only PID how can I find out if the current process works or not? I can't get HANDLE of some processes(There are no sufficient rights).

  • startup manager

    Posted by Legacy on 06/04/2003 07:00am

    Originally posted by: gaurav

    How can i know which are the application currently installed in startup Manager.How can i access them with win32 program with their path and icon.

  • I have a problem while linking the demo code?

    Posted by Legacy on 04/25/2003 07:00am

    Originally posted by: Vijaya


    I downloaded the demo files and tried to build the processviewer.exe. I get the following error.

    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/ProcessViewer.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    ProcessViewer.exe - 4 error(s), 0 warning(s)

    What files am I missing?


  • How I can close any program.

    Posted by Legacy on 04/09/2003 07:00am

    Originally posted by: Rehan Shaukat


    I want to close any programm running on window. please help me.

    THanx in advance.

  • how to get my installed software's name and its (exe) filename

    Posted by Legacy on 09/12/2002 07:00am

    Originally posted by: zhang

    How do I get my computer's installed-softwares'name
    and its (exe)filename before executing the software,
    such as,I have installed office2000 software, but I
    can't know how to get its (exe)filename and its fullpath
    I need it very much

  • How can u view window captions like in ctrl-alt-dlt

    Posted by Legacy on 07/24/2002 07:00am

    Originally posted by: jimmy

    how can u view window captions like in ctrl-alt-dlt.
    please e-mail me it would be much appreciated

  • cntUsage - How can I display CPU - Usage?

    Posted by Legacy on 07/04/2002 07:00am

    Originally posted by: pat


    so you written the program, but why you did not implement the cpu usage? can you make an update?

    or can you tell me why the pEntry.cntUsage returns 0 ?

    well i think you mastered the problem, i plea you to share your experience.

    thx pat.

  • ProcessViewer.exe- Entry Point Not Found

    Posted by Legacy on 06/03/2002 07:00am

    Originally posted by: mar

    When I tried to run it, the following error message
    appears. " The procedure entry point Process32First could
    not be located in the dynamic link library KERNEL32.dll "

    Please Help !!!

    I don't know what to do...

  • tic.exe and Process32First ???

    Posted by Legacy on 02/05/2002 08:00am

    Originally posted by: Concerned Individual

    Hello. I am in need of some advice/help. We are running a small office with a server using WindowsNT (Service Pack 4, Version 6a). Lately, we have noticed an error message pop-up each time after a fresh boot. The message reads as follows:

    "The prodcedure entry point Process32First could not be located in the dynamic link library Kernel32.dll."

    Would you have any suggestions for someone who is not too familiar with computer coding? Would adding this .dll file solve my problems? I would be able to follow directions if given a step-by-step instructions. Thank you.



  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date