LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-02-2011, 05:17 AM   #1
Neoh2009
LQ Newbie
 
Registered: May 2011
Posts: 5

Rep: Reputation: 0
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.
 
Old 05-02-2011, 05:29 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Neoh2009 View Post
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.
 
Old 05-02-2011, 07:12 AM   #3
Neoh2009
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Sergei Steshenko View Post
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.
 
Old 05-02-2011, 11:39 AM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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.
 
1 members found this post helpful.
Old 05-03-2011, 06:13 AM   #5
Neoh2009
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by MTK358 View Post
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.

Last edited by Neoh2009; 05-03-2011 at 06:17 AM.
 
Old 05-04-2011, 09:25 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by MTK358 View Post
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).

--- rod.
 
1 members found this post helpful.
Old 05-04-2011, 10:04 AM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by theNbomr View Post
Cool. Please cite some examples.
FVWM's "FvwmButtons" lets you embed X applications into it.

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/

Last edited by MTK358; 05-04-2011 at 10:18 AM.
 
Old 05-05-2011, 07:54 AM   #8
Neoh2009
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by MTK358 View Post
FVWM's "FvwmButtons" lets you embed X applications into it.

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/
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;
}

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.
 
Old 05-05-2011, 08:02 AM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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.
 
Old 05-06-2011, 10:34 AM   #10
Neoh2009
LQ Newbie
 
Registered: May 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MTK358 View Post
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.
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.
 
Old 05-08-2011, 09:38 AM   #11
ThomasAdam
Member
 
Registered: Apr 2011
Posts: 41

Rep: Reputation: 46
Quote:
Originally Posted by MTK358 View Post
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.

-- Thomas Adam
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[screen program] Using with wine GUI program? Vhann Linux - Server 2 10-25-2009 05:15 PM
first GUI program tamilm Linux - Newbie 1 07-01-2008 05:54 AM
Hide program arguements from ps? jon_k Programming 3 10-29-2006 12:52 AM
In KDE 3.4, Can one hide a program from taskbar. Brian1 Linux - Software 2 09-23-2005 07:05 PM
Kde TaskBar like Gnome with Virtual Desktop (Hide program's tab sent to otherDesktop) fax8 Linux - Software 2 12-18-2004 08:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration