Results 1 to 8 of 8

Thread: Get All Running Process Win32

  1. #1
    Join Date
    Oct 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Get All Running Process Win32

    Hi
    How I Get List Of Running Process On Windows

    And Thanks

    Sorry For Much Qustion

  2. #2
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android
    Thanks
    10
    Thanked 27 Times in 22 Posts

    Default Re: Get All Running Process Win32

    Oleg Shparber

  3. #3
    Join Date
    Oct 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Get All Running Process Win32

    I Tested That
    But I Have Problem

  4. #4
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android
    Thanks
    10
    Thanked 27 Times in 22 Posts

    Default Re: Get All Running Process Win32

    It works fine for me, so explain your problem.
    Oleg Shparber

  5. #5
    Join Date
    Oct 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Get All Running Process Win32

    This is Error

    undefined reference to `EnumProcesses@12'

    The Error in Code :

    if (!EnumProcesses(aProcesses,sizeof(&aProcesses),&cb Needed))return;

  6. #6
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Get All Running Process Win32

    From the docs:
    Kernel32.dll on Windows 7 and Windows Server 2008 R2;
    Psapi.dll if PSAPI_VERSION=1 on Windows 7 and Windows Server 2008 R2;
    Psapi.dll on Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000
    Make sure you link to correct library (specifying -L"path/to/lib/dir" -llibrary_name).

  7. #7
    Join Date
    Feb 2011
    Posts
    64
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    16
    Thanked 2 Times in 2 Posts

    Default Re: Get All Running Process Win32

    Try this:
    Qt Code:
    1. void YourClass::monitor()
    2.  
    3. {
    4.  
    5. unsigned long aProcesses[1024], cbNeeded, cProcesses;
    6.  
    7. if(!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded))
    8.  
    9. cout << "text01";
    10.  
    11.  
    12.  
    13. QStringList lprocess;
    14.  
    15.  
    16.  
    17. cProcesses = cbNeeded / sizeof(unsigned long);
    18.  
    19. for(unsigned int i = 0; i < cProcesses; i++)
    20.  
    21. {
    22.  
    23. if(aProcesses[i] == 0)
    24.  
    25. continue;
    26.  
    27.  
    28.  
    29. HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, aProcesses[i]);
    30.  
    31. wchar_t buffer[50];
    32.  
    33. GetModuleBaseName(hProcess, 0, buffer, 50);
    34.  
    35. CloseHandle(hProcess);
    36.  
    37.  
    38.  
    39. lprocess << QString::fromWCharArray(buffer);
    40.  
    41. }
    42.  
    43. }
    To copy to clipboard, switch view to plain text mode 
    Add this to you pro file project:
    Qt Code:
    1. win32:LIBS += -lpsapi -lmingw32
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Oct 2011
    Posts
    36
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Get All Running Process Win32

    Thanks For All
    Code Worked Fine

Similar Threads

  1. Get Process ID for a running application
    By bob2oneil in forum Qt Programming
    Replies: 5
    Last Post: 10th September 2011, 22:58
  2. Replies: 9
    Last Post: 7th May 2011, 00:36
  3. Destroyed while process is still running
    By qtzcute in forum Qt Programming
    Replies: 5
    Last Post: 23rd July 2009, 09:26
  4. Connecting with QProcess to an already running process
    By high_flyer in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2007, 11:31
  5. Check wheter a process is running
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 15th June 2006, 13:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.