Jump to content

Recommended Posts

Posted (edited)

made some code a while back to figure out what was running on a system and it got me curious... is there a UDF out there that you can determine cpu usage per each window somehow? anyways... as always, here's some code below:
 

#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>

GUICreate("handleview", 300, 600, @DesktopWidth/2, @DesktopHeight/2)
$ListView = GUICtrlCreateListView("Program|HWND", 1, 1, 298, 598)
ProgramFind()
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    SwitchCheck()
WEnd

Func SwitchCheck()
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
EndFunc

Func ProgramFind()
    Local $List = WinList()

        For $i = 1 To $List[0][0]
            GUICtrlCreateListViewItem($List[$i][0]&"|"&$List[$i][1], $ListView)

    Next
EndFunc

kinda curious how you directly call the memory in autoit, like outputting the data of "0x00010000" to  console or something, would be nice to know... been looking at the functions, but can't seem to output the data directly from a hex-specific memory address

Edited by HankHell
Posted (edited)

I know in C++ it's like this...
 

{
            ReadProcessMemory(handle, (PBYTE*)0x00REPLACEWITHMEMORYADDRESS, &readcurrentvalue, sizeof(readcurrentvalue), 0);
            cout << readcurrentvalue << end1;
            Sleep(1000);
            WriteProcessMemory(handle, (LPVOID)0x00REPLACEWITHMEMORYADDRESS, &writenewvalue, sizeof(writenewvalue), 0);
        }

and so on and so-forth... it's really simple... and I could use #include with my C++ script... I'm just wondering if it's possible to do with only autoit...

Edited by HankHell
Posted

You can use WMI Win32_Process to calculate the CPU usage per process.  The UserModeTime and KernelModeTime give you separate usage of CPU.  Add them to get total CPU usage.  You need to create an interval and request the informations at the beginning and the end of the interval.  You get this way CPU usage per process in real time.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...