Window Clippings v3 Sneak Peek – New Options Window – Take 2

I’ve updated the layout a bit to reduce the focus on the configurations. I felt that the configuration selection was too prominent in the earlier builds and I also wanted to make the window simpler and more approachable.



Here you can see the options corresponding to the Image tab in version 2 of Window Clippings. There’s nothing really new here aside from the new color picker. I’ve never liked the built-in color picker that Windows provides so I decided to bake it into the options window even though it’s not a very necessary feature.

Posted by KennyKerr with no comments
Filed under:

Feedback Forum for Window Clippings

Window Clippings has always been very much driven by the feedback I receive from the community. Up till now I have received that feedback primarily via email and comments on my blog.

As I work on version 3 I thought I should try and make this a bit more manageable and open so I’ve set up a Feedback Forum for Window Clippings. I’ve also seeded it with a few suggestions. I still need to go through all my emails and comments and add various other suggestions that I’ve received but hopefully this is enough to get things started as far as the forum is concerned. I obviously can’t guarantee that every suggestion will turn into a product feature but you can bet that popular suggestions will seriously be considered for inclusion.

Please add suggestions and vote!

Posted by KennyKerr with 2 comment(s)
Filed under:

Back to the Future... Please

A new day and a new job as a technology consultant in London. I think this screenshot says it all:

Can you tell what those applications are? I know it’s been a while so let me help you. First up is Visual Studio 2003 sporting the .NET Framework version 1.1. That’s before such fundamentals as TryParse, generics and 64 bit support.  Then there’s Visual C++ 6, released in 1998 if I remember correctly. Finally there’s Internet Explorer 6, as witnessed by the lack of PNG alpha blending (and tabbed browsing). This lovely collection of software is running on Windows XP SP2, released somewhere around 2004.

Just so we’re clear: as I write this it’s nearing the fall of 2008.  Can you feel my pain?  :)

Posted by KennyKerr with 13 comment(s)

Window Clippings v3 Sneak Peek – New Options Window

I’m hoping to get Window Clippings version 3 released before the end of the year but being an evenings and weekends project it’s hard to say for sure. What I did want to start doing is give you a sneak peek of where I’m heading and get your feedback along the way. To kick things off here are some screenshots of the new Options window. In subsequent posts I’ll talk more about the individual features but you can probably guess at a lot of what’s coming up based on what’s in these screenshots. These screenshots are taken on a high resolution screen at 120 DPI so they may appear a bit larger than usual if you’re using the default scaling.

As you can see I’ve finally decided to drop the property sheet as the number of new tabs was becoming overbearing. I hope you like the new layout.

The new window is also resizable to make it easier to manage the growing collection of add-ins:

Please keep in mind that the UI will likely change as I get closer to release and of course the official set of add-ins that will be included with v3 has not yet been finalized.

What do you think?

Posted by KennyKerr with 9 comment(s)
Filed under:

Send your Window Clippings to ImageShack

Maximilian Krauß recently sent me an add-in he wrote for uploading images to ImageShack. I’d never heard of the ImageShack service before but it turns out you can upload and host images for free and without needing to create an account. As you can see, the add-in itself provides no settings:

 

After the image is captured the add-in immediately proceeds to upload the image:

On completion it presents a window with links that you can use to refer to the uploaded image:

You can download it here

Thanks Maximilian!

Posted by KennyKerr with 1 comment(s)
Filed under:

ActionFTP for Window Clippings

Sorry for the lack of updates again. I have a pile of posts in the queue but I just haven’t had the time polish them enough for publishing. Anyway... 

Fred Taylor-Young recently released the ActionFTP add-in for Window Clippings. This is meant to be an improvement over the original FTP add-in that Ari Glaizel wrote. As with the original add-in, ActionFTP is a “Send To” add-in for uploading images to an FTP server. It however adds the ability to edit the image before it is uploaded by passing it to the program of your choice.

You can download it here. While you’re there you can admire his awesome array of monitors. :)

Posted by KennyKerr with no comments
Filed under:

Windows Vista Performance Tuning

Microsoft recently published a document entitled Windows Vista Performance and Tuning. It collects much of the “common knowledge” about optimizing the performance of Windows Vista into a single document. This is a great reference if you’re not that familiar with Vista and want some ideas on how to improve its performance. It’s by no means a complete list but hits on some of the most effective and easily adjusted settings.

If only they used Window Clippings to take their screenshots...

Posted by KennyKerr with 2 comment(s)
Filed under:

Visual C++ in Short: Determining whether a path refers to a file system object

If you’ve been programming Windows for a while (prior to Windows 2000) you may well have come across a number of techniques to determine whether a path refers to a file system object such as a file or directory.

One approach is to check the result of the CreateFile function but this approach has a number of pitfalls. Checking whether a path refers to a file system object should not change the state of the file system object, which CreateFile does in most cases. You can combat this by playing around with the various flags. For example, if you only specify FILE_READ_ATTRIBUTES as the desired access then the file’s last access date won’t be updated. Of course you may not have the necessary authorization to open the file handle at all. There are also other headaches associated with this approach such as remembering to close the file handle should the call to CreateFile succeed. Determining whether the file handle refers to a file or directory involves additional function calls.

Another solution is to use the FindFirstFile function but it gets a lot more data than you might need and you also need to remember to close the search handle.

The shell provides the PathFileExists function which is simpler than the approaches mentioned thus far but is limited in that it does not distinguish between files and directories. Still, if that’s good enough then here’s all you need to do:

const BOOL exists = PathFileExists(L"<some path>");

To be able to distinguish between files and directories involves checking the attributes of the file system object. The simplest way to get a file’s attributes is with the GetFileAttributes function introduced with Windows 2000 a long time ago (see comments). Of course if it fails to return the file attributes you can call the GetLastError function to find out why. That in turn provides a great way to determine whether the path refers to a file system object at all. It can also tell you other useful information such as whether the path is even valid.

The beauty of this model is that you get to decide just how much information you need. For example if you only want to know whether the path exists you can simply check whether GetFileAttributes returns INVALID_FILE_ATTRIBUTES or not. Alternatively you can distinguish between different classes of failure.

The following example shows a simple helper function that singles out the ability for the system to find the specified path from other failures. If a file system object exists it returns S_OK. If the path is well formed but the system cannot find the path or file then it returns S_FALSE. In all other cases it simply returns the specific failure as an HRESULT. It even optionally tells you whether the file system object is a directory or not.

HRESULT FileExists(PCWSTR fileName, bool* isDirectory)
{
   ASSERT(0 != fileName);

   const DWORD attributes = ::GetFileAttributes(fileName);

   if (INVALID_FILE_ATTRIBUTES == attributes)
   {
       const DWORD error = ::GetLastError();

       if (ERROR_FILE_NOT_FOUND == error ||
           ERROR_PATH_NOT_FOUND == error)
       {
           return S_FALSE;
       }
       else
       {
           return HRESULT_FROM_WIN32(error);
       }
   }

   if (0 != isDirectory)
   {
       *isDirectory = 0 != (FILE_ATTRIBUTE_DIRECTORY & attributes);
   }

   return S_OK;
}

You could for example identify syntax errors using the ERROR_INVALID_NAME error code:

bool isDirectory = false;
const HRESULT result = FileExists(L"<some path>", &isDirectory);

if (S_OK == result)
{
    if (isDirectory)
    {
        wprintf(L"Its a directory");
    }
    else
    {
        wprintf(L"Its a file");
    }
}
else if (S_FALSE == result)
{
    wprintf(L"Not found");
}
else
{
    if (HRESULT_FROM_WIN32(ERROR_INVALID_NAME) == result)
    {
        wprintf(L"The syntax is incorrect");
    }
    else
    {
        // Something else is wrong...
        wprintf(AtlGetErrorDescription(result));
    }
}

Incidentally, the PathFileExists function I mentioned above uses GetFileAttributes internally if it determines that you’re running on a supported version of Windows. In other words it’s a reasonable fallback if you need to support older operating systems.

There are also various shortcuts depending on what you intend to do with the path. For example if you just want to create a file and make sure it doesn’t already exist you can simply specify the CREATE_NEW creation disposition and the CreateFile function will fail if the specified file already exists.

If you’re looking for one of my previous articles here is a complete list of them for you to browse through.

Produce the highest quality screenshots with the least amount of effort! Use Window Clippings.

Posted by KennyKerr with 7 comment(s)

Windows with C++: Asynchronous WinHTTP

My latest Windows with C++ column in the August 2008 issue of MSDN Magazine is now online: Asynchronous WinHTTP.

This article had a bit of a rough time in the editing process and it’s not quite as polished as I would like. Nevertheless it’s still a good read and should give you a good starting point for building high performance and highly responsive HTTP client applications.

It was also heavily edited to meet the limited space requirements of print publication and some sections were dropped. One of them was a section on the positioning of WinHTTP compared to WinInet:

Veteran Windows developers may remember the Windows Internet (WinInet) API that has been around for years.  WinInet still provides a number of unique features such as support for FTP, credential caching, and user interface support. On the other hand it is not an ideal solution for service applications. It is also not suitable if your application needs to manage its own credentials, you don’t want to introduce user interface prompts, or don’t want to rely on Internet Explorer for proxy configuration.

The first paragraph in the Request Cancellation section was also edited to the point where it is incorrect and quite misleading. It should read:

WinHTTP provides a less error-prone model for asynchronous completion when compared to WinInet since your application is always notified of the completion of an operation through the callback function. On the hand, since worker threads are used to execute the callback function, cancelling a request does require some attention to detail.

Finally the section entitled Determining Proxy Settings was cut entirely from the print issue but is available as a sidebar in the online issue, although the associated screenshot was omitted.

Phew. Hopefully these minor issues will be straightened out eventually.

If you’re looking for one of my previous articles here is a complete list of them for you to browse through.

Produce the highest quality screenshots with the least amount of effort! Use Window Clippings.

Posted by KennyKerr with 5 comment(s)
Filed under:

Windows 2008 Remote Desktop Color Depth

One of the features of the Remote Desktop Protocol (RDP) 6.1 is the ability for clients to connect with a color depth of 32 bits per pixel (bpp). This allows alpha blending in a terminal session which in turn allows layered windows to work correctly. Although it's a bit of a bandwidth hog, it can be really handy for developers testing graphics applications remotely (or to take great screenshots remotely).

Although this works automatically when connecting remotely to Windows Vista it does not for Windows Server 2008 due to the aforementioned bandwidth hogging. Naturally Windows Server 2008 puts performance first. To enable this feature you need to use the Terminal Services Configuration tool (tsconfig.msc).

1. Right click on the desired connection (e.g. "RDP-Tcp") and click the "Properties" context menu item.

2. Select the "Client Settings" tab in the properties window.

3. Clear the "Limit Maximum Color Depth" check box or adjust the value as needed and click the OK button.

The next time an RDP 6.1 client connects and requests a color depth of 32 bpp, Terminal Services will deliver!

The latest version of RDP (at the time of writing) is 6.1 and is included with the following operating systems:

  • Windows Server 2008
  • Windows Vista Service Pack 1
  • Windows XP Service Pack 3 (client only)

Although I think the 32 bpp color depth support was added in version 6.0, it's usually best to get the latest version.

Produce the highest quality screenshots with the least amount of effort! Use Window Clippings.

Posted by KennyKerr with no comments
Filed under:
More Posts Next page »