From 1082342359cdbde7a3db910c0bbb450e46a9725b Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Mon, 9 Mar 2020 22:48:45 +0100 Subject: [PATCH] WIP check parent process --- app/SysTray-X/windowctrl-win.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/SysTray-X/windowctrl-win.cpp b/app/SysTray-X/windowctrl-win.cpp index f8cd18d..8e32c3d 100644 --- a/app/SysTray-X/windowctrl-win.cpp +++ b/app/SysTray-X/windowctrl-win.cpp @@ -5,7 +5,8 @@ /* * System includes */ -#include +#include +#include #include /* @@ -64,6 +65,19 @@ qint64 WindowCtrlWin::getPpid() } +/* + * Get the process name + */ +QString WindowCtrl::getProcessName( qint64 pid ) +{ + HANDLE proc = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, false, getPpid() ); + char name[ 256 ]; + GetModuleBaseNameA( proc, NULL, name, 256); + + return QString( name ); +} + + /* * Find the window by title */