Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-22-2006, 12:00 PM   #1
Registered: Jun 2005
Posts: 49

Rep: Reputation: 15
taking a screenshot

Mostly I program in c# with mono, but from what I can see, it's impossible to get a screenshot of the desktop with it. I know I can use a external program like xwd but that dumps the screen to the hard drive at inconvenient times. I need to get the screen in memory so I can use it at a later time.

I'm looking for either

1) A way to do this is c#

2) Or a tutorial or something for doing this in a different language.

Thanks for ANY help as I'm really lost at this. It will be appreciated.
Old 04-22-2006, 10:26 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I don't think you can: I believe .Net is a virtualized environment and, although you certainly have access to the pixels in a .Net bitmap, I doubt there's any direct way to access the pixels in the "real" environment outside of your .Net sandbox.

Yet another reason I'm baffled at folks who genuinely seem to prefer C# over C/C++ (which is far more powerful, incurs far less runtime overhead, and is far easier to program without having to "buy in" to any one IDE or another) or Java (which is "purer" OO than C++, runs everywhere, and - when all is said and done - is virtually indistinguishable from C# in purpose and semantics)(yeah: one has delegates; the other has "main(String[] args)" instead of "Main()" - but REALLY...)

Old 04-23-2006, 05:24 AM   #3
Registered: Jun 2005
Posts: 49

Original Poster
Rep: Reputation: 15
Great so it is impossible to do it in c#. I do prefer c# over c++, mainly for the slightly simplified syntax. Also, I haven't "bought into" a IDE, I can use whatever I want.

In windows I have seen examples of using the windows api from c#, and getting the screenshot that way. But obviously that isn't going to work from mono.

So I guess I'm going to have to find a way to do this in a different language then.

Thanks anyway.

Last edited by squimmy; 04-23-2006 at 05:26 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Taking a screenshot of your KDM screen JaySuSE SUSE / openSUSE 12 04-27-2005 01:20 PM
Taking a Screenshot carlosinfl Fedora 2 07-11-2004 01:08 PM
taking a screenshot? |2ainman Linux - General 9 04-25-2004 12:11 PM
Taking a screenshot - need help d33pdream Linux - General 1 03-14-2003 09:29 PM
Taking a screenshot AMDPwred Linux - General 3 03-16-2002 05:05 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:33 AM.

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