Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
Func _CalculateCPUCycle()
Local $hWnd = ""
Local $iPID = ProcessExists("notepad.exe")
Local $aWinList = WinList()
Local $nCycles
For $i = 1 To $aWinList[0][0]
If WinGetProcess($aWinList[$i][0]) = $iPID Then
$hWnd = $aWinList[$i][1]
ExitLoop
EndIf
Next
If $hWnd <> "" Then
$nCycles = DllCall("Kernel32.dll", "UINT64", "QueryProcessCycleTime", "HWND", $hWnd)
MsgBox(1,"hhh", @error)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $nCycles = ' & $nCycles & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
Else
MsgBox(64,"Not Found", "No matching process found.")
EndIf
EndFunc
>Error code: 0
!>16:05:17 AutoIt3.exe ended.rc:-1073741819
>Exit code: -1073741819 Time: 5.323
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace CPUCycles
{
class Program
{
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool QueryProcessCycleTime(IntPtr ProcessHandle, out ulong CycleTime);
static void Main(string[] args)
{
IntPtr hwnd = ProcessExists("notepad");
ulong cycles = 0;
QueryProcessCycleTime(hwnd, out cycles);
Console.WriteLine(cycles);
Console.ReadLine();
}
public static IntPtr ProcessExists(string process)
{
IntPtr hwnd = new IntPtr(0);
if (process.Contains(".exe"))
{
process = process.Replace(".exe", "");
}
Process[] processlist = Process.GetProcesses();
foreach (Process theprocess in processlist)
{
if (theprocess.ProcessName.Contains(process))
{
hwnd = theprocess.Handle;
return hwnd;
}
}
return hwnd;
}
}
}
