ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
I am not sure I understand your question/problem; various GUI toolkits consist of widgets, and the widgets typically have 'show' and 'hide' functions. so, when 'hide' function is called, the widget is hidden. Actually, typically initially widgets are hidden, and 'show' must be called in order to make the widget visible.
I am not sure I understand your question/problem; various GUI toolkits consist of widgets, and the widgets typically have 'show' and 'hide' functions. so, when 'hide' function is called, the widget is hidden. Actually, typically initially widgets are hidden, and 'show' must be called in order to make the widget visible.
Thank you for your answer.
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.
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.
Hello, MTK358.
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.
integrating the existing GUI into a widget of your application. There are many existing X11 apps that do that.
Cool. Please cite some examples.
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).
I am now using Qt to implement my application. I find the docs in Qt4 Assistant. This is a example below, and I hope that will help more people.
#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;
}
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.
I don't really know much about this, I just know that there are applications that can embed other X applications.
Anyway, it's a very cool idea. And thank you for your time.
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.
FVWM's "FvwmButtons" lets you embed X applications into it.
No -- be careful with the word "embed" here. It *does not* use Xembed, which most people might assume. Instead, it simply reparents applications based on whichever hangon it's told to look for. This has the advantage of not having to rely on applications not being Xembed aware. That, and FvwmButtons was written long before that half-broken spec. came about.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.