Getting Cropper to work in Vista

UPDATE: A new version of Cropper with these changes has been released. Grab it here: http://blogs.geekdojo.net/brian/articles/Cropper.aspx

Summary

Cropper is my favorite screenshot utility, mainly because of the plugin support. It's not really usable in Vista because the graphics compositing changes in Vista cause problems with just BLT'ing from the desktop DC so the Cropper form is included in the captures. It's not simple, but you can decompile it, add 4 lines of code, and have a version of Cropper that works in Vista. There's talk of a new version of Cropper, but until then this will let you run Cropper 1.8 on Vista.

Confessions of a screenshot freak

I'm really into screenshot programs. I use them daily while writing a book, writing documentation, writing blog posts, and even OCR'ing screenshots of code. I regularly use several screenshot applications: WinSnap, the Vista Snipping Tool, TimeSnapper (not really a screenshot program; it's a desktop recorder), and Cropper.

Cropper is my favorite program, because it supports plugins like "Send to Flickr". (I've written a few myself, including a few I'm waiting to release until an official Vista version comes out).

The problem

Vista's window compositing system is radically new. I'm not going to pretend that I'm an expert on what's changed, but I do know that copying the desktop image (BitBlt from the Desktop HDC) has changed. The net result is that Cropper's translucent form shows up in the captured images (this image should be completely blank):

CropperCapture[100]

A cheesy solution

Step 1 - Decompile Cropper.exe

Cropper was originally distributed with the source, but for some reason the source hasn't been included with recent versions. It's not obfuscated, though, so you you can get the source in seconds with Reflector and Denis Bauer's File Disassembler plugin.

Step 2 - Modify TransparentCropForm.cs as follows:

 

private void TakeScreenShot(ScreenShotBounds bounds)
{
bool _currentlyVisibile = base.Visible;
this.highlight = true;
base.PaintLayeredWindow();
try
{
base.Hide();
switch (bounds)
{
case ScreenShotBounds.Rectangle:
if (this.isThumbnailed)
{
this.imageCapture.Capture(this.VisibleClientRectangle, this.maxThumbSize);
return;
}
break;

case ScreenShotBounds.ActiveForm:
this.imageCapture.CaptureForegroundForm();
return;

case ScreenShotBounds.FullScreen:
this.imageCapture.CaptureDesktop();
return;

case ScreenShotBounds.Window:
this.imageCapture.CaptureWindowAtPoint(Cursor.Position);
return;

default:
return;
}
this.imageCapture.Capture(this.VisibleClientRectangle);
}
catch (InvalidOperationException exception1)
{
TransparentCropForm.ShowError(exception1.Message,
"Error Taking Screenshot");
return;
}
finally
{
if(_currentlyVisibile)
base.Show();
this.highlight = false;
base.PaintLayeredWindow();
}
}

Only 4 lines were added:

bool _currentyVisible = base.Visible;
base.Hide();
if(_currentlyVisible)
 base.Show();

There are more elegant solutions, but they require changes to a lot more files and require passing references to user interface objects deep into the core DLL's. This solution is good enough for govm't work.

Step 3 - Recompile

This actually turned out to be the hardest part, since for some reason File Decompiler's csproj file had the resource references all confused. If you run into problems, contact me and I can send you my Cropper Vista Ghetto Build.

7 Comments

  • Why not use good ol' ALT+PRINTSCREEN?

    Seriously, explain it to me.

  • Completely unrelated, but I've been looking for something like Denis's plugin for a while now...thanks for mentioning it.

  • Thanks Jon. I thought about hiding the form during a capture in the past. I was not sure how it would look or work and never got around to trying it. I am working on a new WPF interface for Cropper on Vista but in the meantime, now that I have more free time I'll put out an update of the last version with this change. I need to update the installer to handle systems that only have 2.0 of the framework anyway.

  • @Jeff: Yeah, what Steve said.

    The workflow for a PRINTSCREEN capture:
    1. Set up the shot
    2. Hit ALT+PRINTSCREEN
    3. Fire up your graphics program
    4. Crop as desired
    5. Export to the correct format
    6. Decide where to save it
    7. Browse to the file
    8. Actually use it

    For Cropper:
    1. Set up the shot
    2. Select the output plugin on Cropper
    3. Size the Cropper window
    4. Double-click (or hit one of the shortcut keys).

    It's not that cropping, exporting, or uploading an image to Flickr (or printing it, e-mailing it, etc.) is difficult, but it's inconvenient enough that you might choose not to do it.

    WinSnap is very nice (I actually didn't know that it had the Region capture, Steve - thanks for pointing that out). The killer feature in Cropper is that great plugin interface which automates the process of exporting and dispatching each screenshot.

  • @Brian - Great! Hope I wasn't out of line there, I just wanted to help out other Cropper fans who upgrade to Vista and find one of their favorite programs doesn't work!

    Any thoughts on putting Cropper on CodePlex? CodePlex is a lot better than GotDotNet...

  • @Jeff -- one of the simplest, yet nicest features of screenshot programs (Kenny Kerr's for example) is that they give you transparent corners, rather than solid corners. THis is one of those fine details that doesn't matter if you're using the screenshot to lodge a bug report (for example) but does matter if you're intending to publish the intended image.

  • No, It's all good Jon. I have been meaning to release the source for the latest version, but things had been keeping my busy lately and I kept forgetting.

    I have this added in and I am finishing up some additional plugin support I had already started in the 8.0 branch. Should relaeas an update soon.

Comments have been disabled for this content.