Unfortunately, I don't know c#, I imagine the syntax won't be too far off from C\C++, but I wrote a few apps similar to this.
http://www.x-null.net/forums/showthr...nd-save-as-jpg
Few things to consider...
Are your intentions for this to be server or clientside?
I don't think you can force serverside screenshots... I mean let me rephrase this question... You can force it, but the actualy screenshot code would have to be written clientside...
So if you're looking for a fail-proof method in creating a screenshot capture in game, here is what you should consider..
Since this will be clientside, how will you battle someone that can potentially debug your application, and detect when it's triggered. And when it's triggered (assuming you are trying to take a SS of someone wallhacking), they would be able to disable their cheat, take a clean SS and turn the cheat back on.
You would need to come up with a soultion to detect when\if a client is trying to tamper with your function or bypass it. Similarly like we detect if someone has "hacked" stufftext.
The link I provided you with, is an optimized SS application, that takes a bitmap image and compresses it using lossless quality PNG. In other words, a normal BMP can be well over 1mb, however my application is able to compress it to a few kb without distorting the resolution. I found this to be the most effective way. And honestly I find it to be better than MOHAA's current Screenshot function because TGA's are difficult to view on the fly unless you open it in an app like Photoshop.
Anyway, hope this helps. If you're only interested in taking a picture of a specific Window (for example MOHAA) Change this line
Code:
HWND DesktopHwnd = GetDesktopWindow();
to
Code:
HWND DesktopHwnd = FindWindow("Medal of Honor Allied Assault",NULL);
You might want to double check that, but I think that's correct.