LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-17-2005, 03:18 AM   #1
koxin
LQ Newbie
 
Registered: May 2005
Posts: 2

Rep: Reputation: 0
Capturing another application's window


How can I capture the window of another application and save it to disk from inside my program? I use Linux Fedora Core 3.

thanx

Koxin
 
Old 05-17-2005, 09:28 PM   #2
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
when you say "capturing" - do you mean taking a snapshot of the application's window as an image? (just like hitting the print screen)
if that's what you mean, then take a look at xwininfo and import - i think they are part of the ImageMagick package. you can use xwininfo to get the properties for the target window and then use import to capture the contents of that window and put it in a file. something like:

# get the window id of an application window named "screen"
windowid=`/usr/bin/X11/xwininfo -name screen -display localhost:0 | grep
xwininfo | awk '{ print $4}'`
# do the capture
/usr/bin/import -silent -display localhost:0 -window $windowid ~/cms.gif

the commands above are on a script that is run by cron. requirement: the active terminal should be the X session itself.
 
Old 05-18-2005, 01:13 AM   #3
koxin
LQ Newbie
 
Registered: May 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Yes,

that's exactly what I wanted. I only need to do this in C language and I'd like to capture the whole window not just the client area. By the way, do you know how to do this?

thanks

koxin
 
Old 05-18-2005, 08:11 PM   #4
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
the commands are open source, so...... (check http://www.imagemagick.org/ for the source code).

sorry, not that into programming nowadays.

happy coding.
 
  


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
Capturing the window close event in X phanna Programming 1 09-01-2005 08:04 AM
Best Capturing tool. mayankjohri Linux - Enterprise 0 01-30-2005 03:12 PM
Screen Capturing monohouse Linux - Software 3 10-30-2004 11:14 AM
Known Application's from source Tamsco Fedora 0 08-05-2004 04:13 PM
Capturing video with Cinelerra works, capturing video with Xawtv doesn't! seaelf Slackware 0 06-27-2004 05:18 PM

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

All times are GMT -5. The time now is 08:37 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