Archive for November, 2009

November 2009 IT Toolbox Column for TechNet Magazine

Thursday, November 5th, 2009

The November 2009 issue of TechNet Magazine is out on the website. Check out my IT Toolbox column here:

November 2009 TechNet Magazine IT Toolbox

In this issue I covered:

  • BeyondCompare 3: Compare, Merge And Synchronize Files And Folders
  • WhatIsMyIp.com: Get IP Details; Test Connection Speed
  • ADRecycleBin: Find and Restore Deleted AD Objects

Check it out and let me know what you think!

And if you have a tool you want to see me review, please suggest it to me here: tntools@microsoft.com.

Also, as some of you know, this was the last print issue of TechNet Magazine. :(

But the digital edition will continue, so read on I say, read on! :)

Retrieve Image from Windows Clipboard via .Net C#

Monday, November 2nd, 2009

If you want to snag clipboard data from a different application into the context of your running .Net application, here’s how you can do it:

private static Image _clipBoardImage = null;

private static Image GetImageFromCopyPasteBuffer()
{
Thread t = new Thread(new ThreadStart(GetClipboardBitmap));
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
return _clipBoardImage;
}

private static void GetClipboardBitmap()
{
IDataObject data = Clipboard.GetDataObject();
if (data == null || !data.GetDataPresent(DataFormats.Bitmap, true))
throw new ApplicationException("No clipboard image data was present.");
_clipBoardImage = (Image)data.GetData(DataFormats.Bitmap);
}

Hope this helps!