Hola,
He logrado obtener en mi app el titulo y nombre del proceso de la ventana activa, lo logre utilizando este metodo:
Código C++:
Ver original#include <QCoreApplication>
#include <QString>
#include <QDebug>
#include <string>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <string>
#include <unistd.h>
using namespace std;
inline std::string exec(char* cmd) {
FILE* pipe = popen(cmd, "r");
if (!pipe) return "ERROR";
char buffer[128];
std::string result = "";
if(fgets(buffer
, 128, pipe
) != NULL
) result += buffer;
}
pclose(pipe);
return result;
}
int main(int argc, char *argv[]){
QCoreApplication app(argc,argv);
Qstring title = exec("xdotool getactivewindow getwindowname").c_str();
QString name = exec("cat /proc/$(xdotool getwindowpid $(xdotool getwindowfocus))/comm").c_str();
return app.exec();
}
Este funciona perfectamente, sin embargo necesito lograr hacer esto pero sin el cmd, osea sin tener q llamar al exec, hay alguna forma de hacerlo ??