Snoop Tips & Tricks #3: The Crosshairs

Ok, I know it has been forever since the last Snoop trick! My apologies! I have a whole list of things that I want to show off … but, man, where do people find the time to do these types of things?! Thinking smile

Often, I have had to choose between working on Snoop … versus documenting what it can do. I have often chosen the former because I think that Snoop is fairly obvious to use … but then I am reminded that I am an expert user of it and that many of its features are really quite hidden. For example, how can you easily select the visuals you want to Snoop on? Why, with the Ctrl-Shift Mouse Over trick, of course. Our first two tricks (Trick 1, Trick 2) covered that particular piece of hidden functionality.

Since those tricks, we have had a couple releases of Snoop (2.7.0 and 2.7.1). We have even converted the CodePlex Snoop repository to Git and also have a sibling repository at GitHub.

So, in this trick, I want to show off a new piece of functionality that we introduced in version 2.7.0 … what I like to call the crosshairs functionality.

This functionality is all about avoiding the combo box of Snoopable applications. It took forever to iterate over all the applications on the system … seeing if each one was a WPF app or not … and filling up the combo box as we go. Why couldn’t we just select that app that we want to Snoop with the cursor? And that is exactly what we did.

Snoop Tips & Tricks #3: The Crosshairs


Now, it is super fast to Snoop an app! You simply launch the Snoop app chooser, drag the crosshairs on top of the app you want to Snoop … and wham bam … you are Snooping.

Thank you Anvaka for implementing this feature!

Happy Snooping!

Snoop Tips & Tricks #2: Snooping Transient Visuals

In this trick, I show you how useful the prior one can really be.

That is, it can be used to Snoop transient visuals … or visuals that aren’t currently in the visual tree. A perfect example of this type of visual … are combo box items.

Snoop Tips & Tricks #2: Snooping Transient Visuals

One thing I forgot to mention in the video … check out the root of the visual tree after I have used the Ctrl-Shift Mouse Over trick on the combo box item … it is not an App object … but a PopupRoot object. This is further indication that Snoop has refreshed the visual tree and placed the transient visual there in place of the normal App object.

Happy Snooping!

Snoop Tips & Tricks #1: Ctrl-Shift Mouse Over

I am always surprised how many people don’t know about this trick … but I guess it isn’t really obvious since I removed the tip from the status bar … in favor of some keyboard functionality.

I thought the best way to show this trick off … is with a screencast. Enjoy!

Snoop Tips & Tricks #1: Ctrl-Shift Mouse Over

Snoop: Now Supports WPF 4.0 Even Better in Snoop v2.6.1

Problems, Problems

The above blog post title is supposed to be kind of a joke. I keep telling people I’m funny. Snoop supposedly has been supporting WPF 4.0 for some time now. Unfortunately, however, there were times where (1, 2) WPF 4.0 applications weren’t showing up in the App Chooser.

In one situation, PresentationFramework.dll wasn’t showing up in the list of loaded modules for the application being Snooped. So, I simply started searching for any of the following assemblies: PresentationFramework.dll, PresentationCore.dll, or wpfgfx_v0400.dll.

But, that didn’t work in all situations.

For sometimes, PresentationFramework.dll shows up as which I believe is the Ngen(ed) version of the assembly. At other times, it isn’t wpfgfx_v0400.dll that shows up in the list of modules, but wpfgfx_v0300.dll. The former is the milcore for WPF 4.0 and the latter is the milcore for WPF 3.5.

At this point, I just searched for the roots of all these names, i.e. PresentationFramework, PresentationCore, and wpfgfx.

But, again … that didn’t work in all situations. Humility, is a virtue … humility is a virtue. Annoyed

For some reason, at times, these modules show up in lower case. Don’t ask me why. If someone can shed light on this, please do. So, I’m now searching for the roots of these assemblies in a case-insensitive way. Granted, I probably should have seen that one coming.

Snoop v2.6.1

Now announcing Snoop v2.6.1!

Snoop v2.6.1 fixes these issues and others. After yet another fellow experienced this problem and since more people are going WPF 4.0 all the time … I figured it was time for a release.

This release also contains some usability improvements from fellow Snoop aficionado, Dan Hanan. In particular:

  1. You can now delve properties by double clicking on the name.
  2. You can now modify the filter sets to contain what you wish to be filtered.
  3. You can now use the mouse wheel to modify property values.
    I also want to say that I have a whole bunch of things lined up for integration into Snoop, but have been struggling to find time. For example, another fellow added the ability to capture some hi-res screen shots from Snoop. So, there is definitely going to be a vNext for Snoop … and hopefully soon.

Snoop Tips & Tricks

For a while now, I’ve been contemplating a blog series on Snoop where I highlight different tips and tricks, and in general, how to use Snoop. And with this release, I’m going to kick it off with the most important one of them all: the Ctrl-Shift Mouse Over trick.

Snoop: Yes, You Can Snoop XBAPs

Today I got a question about whether Snoop supports XBAPs. Actually, this is something I’ve been meaning to look into for a while.

So, I took the two necessary seconds to create a test XBAP project and tried Snooping. It didn’t work. When launching Snoop after running the XBAP, you see PresentationHost.exe in the App Chooser (PresentationHost.exe is the process that the browser launches in the case of an XBAP).


However, trying to Snoop it (clicking the binoculars) … results in … nothing, not even an error.

Now, the person asking … pointed out a Josh Smith’s blog post on the matter … where he discusses three tips for working with XBAPs … one of which is that Snoop doesn’t work, but that Mole does. In order to get Mole to work, however, you must (at least temporarily) make your XBAP a full trust application.

Hmm. That got me thinking. Yes, I know that is dangerous.

A lot of my efforts with Snoop to date … have revolved around getting edge case scenarios to work … and I have modified the start up process significantly. So, I thought, I should quickly check to see if Snoop now works … as long as I change the XBAP to a full trust application.

And … woohoo … it works! Thumbs up

So, all you need to do is go to the Project Properties window, navigate to the Security tab, and check ‘This is a full trust application’.


Hope that helps, and yeah, Snoop rules!


I did also verify (while writing up this post) that neither Snoop 1.0 (Pete Blois’ original version) nor Snoop 2.0 (Pete Blois’ newer stylized version) worked with XBAPs.

Snoop: There can be only one!

Haven’t I already said that the community has just been awesome in regards to Snoop?

Well, here is another piece of evidence!

The other day, a developer, Bruno Martinez, from Uruguay contacted me and wanted to contribute to Snoop by making it so that there was only 1 version, instead of the 4 currently required at that point.

If you recall …

  1. You needed a version for WPF 3.5 and 32-bit.
  2. You needed a version for WPF 3.5 and 64-bit.
  3. You needed a version for WPF 4.0 and 32-bit.
  4. You needed a version for WPF 4.0 and 64-bit.

Yuck! Of course, it was better than not being able to Snoop in those situations. 🙂

Well, after integrating Bruno’s changes … you just need:

  1. Snoop


Yeah, that’s right. There are no labels! Thank you, Bruno!

I’m obviously tickled by this … since it was a usability nightmare trying to figure out what version you needed to run … but there are host of other fixes/improvements as well. In particular, the Snoop start-up process is much more robust than it used to be and it can handle some fringe cases that it wasn’t able to before.

Please go to for more info, and of course, the download/release area for version 2.6.0.

Happy Snooping!

Snoop: Now Supports WPF 4.0

This is just a quick post to point people to the fact that I have updated Snoop on CodePlex ( such that it now supports WPF 4.0.

If you try to Snoop a WPF 4.0 application with the WPF 3.5 version, you will get the following error message:


I speculate that this is because there is a brand new CLR with .NET 4.0 (WPF 4.0) applications. Yes, that’s right, a brand new CLR. We haven’t had one of those for a while.

If someone can confirm this or provide a better understanding of why I can’t Snoop WPF 4.0 applications without retargeting Snoop to .NET 4.0 … please shed some light for me.

So, there are now 4, count them, 4 versions of Snoop:

  1. Snoop 32-bit for WPF 3.5
  2. Snoop 64-bit for WPF 3.5
  3. Snoop 32-bit for WPF 4.0
  4. Snoop 64-bit for WPF 4.0
    You need to use the right version of Snoop in each particular situation … otherwise … thar will be problems, matey!

I have also added another label to the app chooser so that you know which version you currently have up. Take a look … this is what it looks like for the 64-bit/WPF 4.0 version:


Let me know if you have any problems by creating a discussion (or participating in a current one) on the site.

Enjoy and happy Snooping! 🙂

Snoop: Now on CodePlex


Snoop is now on CodePlex at

The community reception to my efforts (blog posts: 1, 2, 3) on Snoop have been wonderful. Some like Anvaka have offered additional feature suggestions; others have just encouraged me.

In my last post, a fellow commented asking why it wasn’t up on CodePlex. Well, this was a great suggestion and one that I had actually already considered. That prompted me to email Pete Blois (the original author) for his permission. He graciously gave it and so I then proceeded to put it up there.

It took me a little while, but I now have the initial bits uploaded … that is, the same stuff that is available here at my blog.

Now, there are a bunch of things on the todo list. Most notably, I’ve already modified Snoop so that it works for WPF 4.0 … and definitely want to share that with the world.

So, please be patient, I’ll get to it. Those silly day jobs! 😀

Some Info

If you are going to download the source code and build it, some comments are in order (I’ll put this out at the CodePlex site too).

There are (go to Build->Configuration Manager) 3 solution platforms (x86, x64, Any CPU) and 2 solution configurations (Debug, Release). The x86 platform is for 32-bit, the x64 platform is obviously for 64-bit, but … what is Any CPU?

Well, Any CPU is only around for Blendability. That is, for some odd reason, I couldn’t bring up the Blend designer Snoop’s window unless it was in this configuration. I have intentionally marked the ManagedInjector project to not be built under the Any CPU configuration. Since Any CPU will run as 32-bit on 32-bit operating systems and as 64-bit on 64-bit operating systems, using Any CPU will likely cause a mismatch (and a headache :)) with the ManagedInjector dll.  The project which builds the ManagedInjector.dll is a C++ project and there isn’t an Any CPU setting for those (they can only be specifically built to Win32 or x64).

Or, in other words, make sure you switch into another platform, before you build or the build will fail.

Here’s a chart for quick reference:

Platform Configuration Notes
x86 Debug For 32-bit.
x86 Release For 32-bit, builds the installer.
x64 Debug For 64-bit.
x64 Release For 64-bit, builds the installer.
Any CPU Debug, Release Only for Blendability. Do not use.


Call to Action

If you have a feature request or want to be involved somehow (maybe as a contributor), please don’t hesitate to contact me.

For near future though, I’m going to keep the project closed until I can change the copyright info to Ms-PL and clean up the code a bit.


Finally, I want to publicly thank Pete Blois for first creating this awesome tool and for giving us the permission to get it going on CodePlex. A big thanks Pete!

Snoop: Now with 64-bit Support and More

The other day I was rebuilding an application such that it would specifically target the x86 platform … solely because I wanted to Snoop it.

I’ve done this many, many times because it is the only way I’ve been able to Snoop applications on my Windows 7 64-bit operating system. And, I thought, “Boy, this is stupid. I should be able to build a 64-bit version of Snoop such that I don’t have to do this anymore.”

And that is exactly what I did.

Now … presenting Snoop 32-bit!


And Snoop 64-bit!


Here are the binaries for the 32-bit version and here are the binaries for the 64-bit version.

(The binaries are now (see posts: 1, 2) up on CodePlex. Please go download it from there as those binaries will contain the latest and greatest bits.)

It was rather a simple matter really. I just needed to change all the project configurations so that they targeted the x64 platform … for the x64 version of Snoop … and all the project configurations so that they targeted the x86 platform … for the x86 version of Snoop.

This was so easy and worked so nicely … that I searched the internet to see if anyone had done this already … and I found Dan Hanan’s nice post on the matter.

The problem, though, was that he did it for original version of Snoop … and not the nicely styled and improved version that Pete Blois currently is making available since property editing was originally (still?) broken in that version. However, he also had several nice usability features that I was drooling over and wanted for my very own. 😀 And I, of course, have already fixed the property editing issue in my version (see previous posts: 1, 2) with a little help from Mark Kharitonov (see this forum post for more info on that).

So, I emailed him, got his permission to integrate those changes, and promptly did so. I also added a few improvements myself.

The Improvements

Here is what has been improved (over and above Pete Blois’ current version):

Improvement Originator
Handles WPF interop scenarios (both Windows Forms hosting WPF and WPF hosting Windows Forms). Cory Plotts
Fixed the ability to edit properties. Mark Kharitonov
Modified Snoop so that it can handle visual trees that have nesting greater than 255 levels deep. Mark Kharitonov
Modified the project configurations so that you can build a 32-bit version and a 64-bit version. This is what the blog post is all about! Ha! Cory Plotts
Dan Hanan
Turned off the showing of properties at their default value (by untoggling the Show Defaults toggle button). Dan Hanan
Turned auto refresh off in the AppChooser. Snoop was previously polling every 20 seconds for new applications. Dan Hanan
Added a checkbox to turn auto refresh back on (if you so desire). Dan Hanan
Added a label to the AppChooser to indicate 32-bit versus 64-bit. Dan Hanan
Added a wait cursor when the AppChooser is busy iterating over the applications to possibly Snoop. Dan Hanan
Added the capability to bring the selected tree view item into view. Dan Hanan
Added the capability to filter properties based on predefined sets of properties. Dan Hanan
Added the ability to pop the target (after a delve) with the back button on the mouse. Dan Hanan
Modified the selected item in the tree view to be a light blue even when it doesn’t have focus. Dan Hanan
Added the ability to pop the target (after a delve) with the alt-left arrow keyboard sequence. Cory Plotts
Added the ability to remember window position, size, and the maximized/minimized/normal state for all three Snoop windows. Cory Plotts
Removed the filtering of ‘devenv’ out from the list of applications that you can Snoop. Cory Plotts
Modified the project configurations so that it never builds the installer. I just copy the Snoop executable and the ManagedInjector dll from place to place. Don’t know if this an improvement. 🙂 Cory Plotts
Fixed the x86 installer and created an installer for x64. Snoop is no longer being added to the GAC and the assemblies are thus no longer strong named. The installers for both platforms should now work. Cory Plotts
Integrated Anvaka’s great suggestion below (see the comments). That is, I moved the long label that tells a user how to ctrl-shift click on the application being Snoop(ed) (to a tool tip on the tree view) … and replaced it with a label that tells the user what the immediate following hyperlink is … that is, the Keyboard.FocusedElement. Also added another label and hyperlink for the current selection’s focus scope. Andrei Kashcha (Anvaka)

I chose not to integrate a couple of Dan Hanan’s changes. First, I did not integrate the ‘indexer delve’. Well, actually I did, but then noticed that Pete Blois’ new version already allowed you to delve into items in a collection … and so I backed it out.

Second, I did not integrate the ‘use 2nd monitor if present’ feature. I liked that feature but thought that I would try to improve upon it by remembering the position and size of all the windows … regardless of the number of monitors. So, with a little help from this StackOverflow question and this MSDN sample … that is what I did. It seems to work nicely. Let me know if you have any problems with it.

Snoop(ing) Visual Studio 2010

Finally, ever since I’ve installed Visual Studio 2010, I’ve wanted to take a peek under the covers with Snoop (remember … Microsoft used WPF in this latest version of Visual Studio). I originally thought I couldn’t Snoop it … because it was running as a 64-bit application and I only had a 32-bit version of Snoop.

So, when I got the 64-bit version of Snoop going, I quickly tried Snooping Visual Studio 2010. No luck! Bringing up task manager, I quickly remembered that Visual Studio runs as a 32-bit application on 64-bit operating systems. See this post by Rico Mariani for more info.

As I have recently been invited into the WPF Disciples group, I posed the question there. Imagine my surprise to find out that devenv.exe was manually being filtered out (since Visual Studio 2008 would load WPF assemblies … but Snoop would fail since Visual Studio 2008 wasn’t built with WPF).

That gave me quite the chuckle. Or, more like, duh! So, promptly removed that and Snoop(ed) Visual Studio 2010 to my delight (check out the red Snoop adorner):


And, of course, the Snoop AppChooser:


And, finally, the main Snoop user interface:


I think that is so cool. Ok, I know … I need mental help. 😀

The Source Code

In the past, I have not released the source code since I have wanted to get Pete’s permission before I do so. I actually met him at PDC 2009 this year. I brought up the fact that I had modified Snoop to handle interop scenarios … but I forgot to ask him about the source code!

There are so many changes now … that I think it would be counter-productive to not release it … in case someone else wants to take Snoop even further than I (and Dan and Mark) have. If you do modify it … and take it further … please let me know! I would love the chance to determine whether to integrate the changes into this version.

So, here it is: the source code.

(The source code is now (see posts: 1, 2) up on CodePlex. Please go download it from there as that code will contain the latest and greatest bits.)


p.s. If you were one of the few who pulled down the binaries immediately after I posted it, then you may not have gotten the Snoop.exe.config file. Unfortunately, in this case, Snoop does not seem to close down all the way (i.e. I had to manually kill it through task manager). You’ll want to get the latest binaries that do include the Snoop.exe.config file … or manually rebuild them yourself with the source code.

An Update

See above (in the table of improvements), but I fixed the installers and integrated a nice idea by Anvaka. All the attached binaries (which should be installers now) and source code have been updated.

Blend Modes: Hue, Saturation, Color, and Luminosity with WPF 4.0

I’ve been toying with and working on this blend mode library of mine for some time now (see posts 1, 2, 3, 4, 5). However, it is now only with WPF 4.0 (currently Beta 2) … that I can actually implement all the blend modes.

Hue, Saturation, Color, and Luminosity: Where Are You?

If you were watching closely, you will have noticed that I have not (to date) implemented the Hue, Saturation, Color, and Luminosity blend mode effects.

Why is that? Whenever fxc.exe would compile the .fx file (through the Shader Effects BuildTask and Templates), it would give me the following two errors:

  • error X5608: Compiled shader code uses too many arithmetic instruction slots (100). Max. allowed by target (ps_2_0) is 64.
  • error X5609: Compiled shader code uses too many instruction slots (102). Max. allowed by the target (ps_2_0) is 96.

Those errors mean that you’ve exceeded the limitations of Pixel Shader 2.0 … which is what WPF 3.5 SP1 targets for pixel shader effects.

So, what can you do about this? You could optimize the HLSL so that your effect code goes under the limits … but if you notice in the errors above (these particular errors are for the Saturation effect) … you will see that I am significantly above the number of allowed arithmetic instruction slots (100 versus 64). I would have to optimize significantly.

WPF 4.0 to the Rescue

Another option is to utilize WPF 4.0!

WPF 4.0 increases what you can do with effects because it now allows you to target Pixel Shader 3.0. This wikipedia article has a great chart on the differences between the different shader models. With PS 3.0, we shouldn’t hit any limits.

Realizing this, as soon as Visual Studio 2010 and .NET 4 Beta 2 came out (PS 3.0 is only available in Beta 2), I installed it and gave it a whirl. There was really only one gotcha in getting this to work. The Shader Effects BuildTask only compiles to PS 2.0 … and there is no option to toggle between PS 2.0 and PS 3.0.

This means that, for now, probably until release, you will have to manually run fxc.exe (targeting ps_3_0) and add the compiled shader output file (the .ps file) to the project as a Resource.


There are some caveats to using PS 3.0 in WPF 4.0. Most notably, there is no software fallback if your hardware or situation (remote desktop, forced software rendering) don’t support it. This means that your effect code will simply not run and not appear.

Some good news is that Microsoft has extended the RenderCapability API so that you can determine what level of pixel shader support is currently available. They’ve updated the RenderCapability.IsPixelShaderVersionSupported method and have added two additional methods: RenderCapability.IsPixelShaderVersionSupportedInSoftware and RenderCapability.MaxPixelShaderInstructionSlots.

(The above information and more is available in David Teitlebaum’s PDC09 session titled Mastering WPF Graphics and Beyond. Jamie Rodriguez also has some great posts covering what’s new in WPF 4.0 (Beta 1, Beta 2).)

Another caveat that bears mentioning is that Silverlight (both 3.0 and 4.0) only support PS 2.0. So, if you are creating and using effects across both technologies, you will not be able to use PS 3.0. This also means that the Hue, Saturation, Color, and Luminosity blend modes (and the attached code) are WPF only blend modes. Sorry Silverlight! I love you, but that’s how the chips fall.

Hue, Saturation, Color, and Luminosity: Here They Are!

Alright … enough with the caveats! Let’s see the effects!

First, let me refer you back to Angie Bowen’s post where she covers what each blend mode does … including the Hue, Saturation, Color and Luminosity effects.

To show off what each effect does, I’m going to go ahead and use her reference images … first showing how they blend out of Photoshop … and then showing how they blend with my library … for comparison purposes. Why? Well, it seems as if my blend mode library does not always match what is coming out of Photoshop … sometimes it’s pretty darn close and at other times it’s more than just a little bit off.

I have been through and through the math (and HLSL) for these effects and I honestly can’t find anything wrong there. If I could speculate what is going on, I would say that I’m bumping up against some float versus double precision issues (where Photoshop is using doubles for greater precision) during the conversion from RGB to HSL and back. If you can figure out what I’ve done wrong (if anything) please let me know.

However, for the most part, they work great!

Hue Blend Mode

The result is the hue of the blend layer and the saturation and luminance of the base layer.



My Blend Mode Library




My Blend Mode Library


Saturation Blend Mode

The result is the saturation of the blend layer and the hue and luminance of the base layer.



My Blend Mode Library




My Blend Mode Library


Color Blend Mode

The result is luminance of the base layer and the hue and the saturation of the blend layer.



My Blend Mode Library




My Blend Mode Library


Luminosity Blend Mode

The result is hue and the saturation of the base layer and the luminosity of the blend layer.



My Blend Mode Library




My Blend Mode Library


The Binaries and the Source Code

Here is the source code for the library and here is the assembly.

Again, remember that this is a WPF-only release as Silverlight does not yet have support for Pixel Shader 3.0.

Also, all of these new blend modes are opacity aware … meaning that you can pull the opacity out of the upper layer to lessen the effect of the blend mode (see my last post on the matter).



At one point, I thought that the Shader Effects BuildTask and Templates was built into Visual Studio 2010. It appears I was mistaken about that. I have updated this post to indicate that.