How to hide a program's GUI?
Hello everyone! Firstly, I will apologize if this question has been asked. I have googled for nearly a week, and did not gain a lot. I am not green to both linux or programming, but I found this is a tough question for me. I hope anyone of you can help me. I will be very thankful.
Now I am going to descrip the question in detail.(Sorry for my poor English, because it's not my mother tongue) I want to implement a software that can show other programs in mine. Consequently, I shoud firstly let the program hide when running, and then I get the screen shot of it. I know this sounds incredible. But someone has already implemented it, such as VNC. The VNC can open another display(display is a word used in X Window), and the VNC can take a screen shot and show it to the client. I will be appreciate if anyone can give me some guidances. Thanks again. |
Quote:
|
Quote:
I am sorry if I am not make the question clear. I know there are some libs for GUI programming and they have the functions to hide a Widget. For example, it's easy to make a window, which you designed, to hide with Qt. But the window that I want to hide is not designed by me. It is created by an application that has already been compiled and linked to a binary file. And I want to run this binary file but hide the GUI. I have two ways in my mind. 1.redirect the GUI output to another virtual device. 2.open another display to paint the GUI. I think the second way is more possible to implement. Because it's the way the VNC uses. |
I think that intead of thinking about hiding the original GUI and taking screenshots, you should think about integrating the existing GUI into a widget of your application. There are many existing X11 apps that do that.
|
Quote:
Yes, that's a good idea! But I have no idea about the Xlib or X11. Can you give me an example? For example, give me a function to implement this or the X11 apps' names. Now, I am going to do some research in the X11 and Xlib. And thank you for your idea which help me a lot. |
Quote:
To the OP: if your GUI applications are known to use X, then one method that can be used to conceal an application's GUI is to run it with a virtual X server. The standard for this is Xvfb (X virtual frame buffer). It is an X server that provides no visual output, and no keyboard or pointer, but allows client applications to use X services. It's screen representation is stored in a specified disk file, and the file format can be captured as a bitmap image, should you need it for some visualization or analysis (or embedding, perhaps). --- rod. |
Quote:
I also heard that Qt can do it with something called "QX11Embed", but I can't find any docs, just some forum and mailing list dicsussions about it. EDIT: http://doc.trolltech.com/solutions/qtxembed/ |
Quote:
#include <QtGui> #include <QApplication> #include <QX11EmbedContainer> int main(int argc, char *argv[]) { QApplication app(argc, argv); if (app.arguments().count() != 2) { qFatal("Error - expected executable path as argument"); return 1; } QX11EmbedContainer container; container.show(); QProcess process(&container); QString executable(app.arguments()[1]); QStringList arguments; arguments << QString::number(container.winId()); process.start(executable, arguments); int status = app.exec(); process.close(); return status; } // you try execute "./main $path/$myAppName" to see whether it works or not. There's a limitation for QX11EmbedContainer according to the Assistant. The QX11EmbedContainer can only embed the XEmbed widgets. "XEmbed is an X11 protocol that supports the embedding of a widget from one application into another application." But how can I know which application follow the XEmbed proticol? I am still working on it. |
Maybe XEmbed isn't what you're looking for.
I don't really know much about this, I just know that there are applications that can embed other X applications. |
Quote:
I've found it is possible to open another display on linux platform. And I think I am close to the answer. Now, the task for me is to setup configurations to the X window. This task may not be about programming. I will do the research by myself. |
Quote:
-- Thomas Adam |
All times are GMT -5. The time now is 01:12 AM. |