import 'dart:io'
...
print(pid);
This code print the pid of my Flutter application. But I want to get the other apps’ pid when I switch on that app.
Suppose, I am now on skype app. So this print(pid)
will print pid of skype. When I switch on notepad it will print notepads pid.
Is there any way to do that?
Thanks in advance.
I’ve searched way to access psapi.dll using dart:ffi
. But got nothing.
2
Answers
Finally I was able to find the solution.
Platform-precise code and having access to local APIs. In the case of Windows, you could use the Win32 API to get statistics about the active window and its process ID. To do this, you may use Dart’s FFI (Foreign Function Interface) to name capabilities from dynamic hyperlink libraries (DLLs) like user32.Dll and psapi.Dll.
Here is an example