Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 8

Qt-interest Archive, October 2006
How to get list of running processes


Message 1 in thread

OK, this has been bugging me for awhile.  I am converting a .NET project to Qt.  One of the things it does is display a list of the running processes.  I've looked for something similar in Qt, but haven't found it.  Anyone know what I'm missing?

Mike 

Message 2 in thread

Am Sonntag, 29. Oktober 2006 02:23 schrieb Mike Welch:
> OK, this has been bugging me for awhile.  I am converting a .NET project to
> Qt.  One of the things it does is display a list of the running processes. 
> I've looked for something similar in Qt, but haven't found it.  Anyone know
> what I'm missing?
I'm afraid you have to do it using plattform-specific code... for win32 
there're a lot of code-examples for EnumProcesses(...). So you could insert 
all the process-names in a QStringList and add this to an according view.

Under Linux things get a bit more complicated if you want a clean solution. 
HACK: You *could*  use QProcess for running "ps aux" or similiar and read the 
stdout of it and parse it. Otherwise you would have to deal with some 
system-functions, maybe you want to take a look at ps-sourcecode or so...

toby

Attachment:

Attachment: pgpdbUPcMXs2A.pgp
Description: PGP signature


Message 3 in thread

Tobias Doerffel wrote:

> Am Sonntag, 29. Oktober 2006 02:23 schrieb Mike Welch:
>> OK, this has been bugging me for awhile.  I am converting a .NET project
>> to
>> Qt.  One of the things it does is display a list of the running
>> processes.
>> I've looked for something similar in Qt, but haven't found it.  Anyone
>> know what I'm missing?
> I'm afraid you have to do it using plattform-specific code... for win32
> there're a lot of code-examples for EnumProcesses(...). So you could
> insert all the process-names in a QStringList and add this to an according
> view.
> 
> Under Linux things get a bit more complicated if you want a clean
> solution.
> HACK: You *could*  use QProcess for running "ps aux" or similiar and read
> the stdout of it and parse it. Otherwise you would have to deal with some
> system-functions, maybe you want to take a look at ps-sourcecode or so...

Under linux you can also use the /proc virtual filesystem. You can access
them using the standard Qt file handling objects. Note though that this
will work on (modern?) Linux systems, not nessecairaly on older systems,
BSD's, etc.

André

-- 
 [ signature omitted ]