Author Topic: Serious use of a system DLL call. aka: I haven seen one created yet.  (Read 5824 times)

0 Members and 1 Guest are viewing this topic.

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
I have used past examples and input from the master denizen's for a number of good system DLL calls.  Now the serious part.

I only know enough to get into serious trouble making a system DLL call.  So I would like to leave that to the pro's here.  What I need is a way to get to the system metrics like system process and CPU usage.  I am using a nice GUI that can compress PNG graphic files.  It's only nice because it has all the options (check box'es etc..) to make the calls to the cmdline program.  It falls down and goes boom when an error on conversion happens.  Since the cmdline program can be called repeatedly, multi-threading is possible, more like multi-switching.
If I can monitor process and CPU I can determine when I should make another shell call.  It's a re-write for the defective GUI program.

This would make another great tool, for other cmdline driven programs.
Any takers ?

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
Re: Serious use of a system DLL call. aka: I haven seen one created yet.
« Reply #1 on: November 22, 2019, 07:11:27 am »
I think I found a way, but I still fail to understand the interfacing.

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getsystemtimes?redirectedfrom=MSDN

If you subtract the idle time.  You will have a good count of CPU usage  %.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Serious use of a system DLL call. aka: I haven seen one created yet.
« Reply #2 on: November 22, 2019, 07:31:22 am »
yes, it looks like you are on the right track, see https://www.codeproject.com/Articles/9113/Get-CPU-Usage-with-GetSystemTimes