But when we try and run the code we get a NullReferenceException back, to be precise, we get:

System.NullReferenceException occurred
Message="Object reference not set to an instance of an object."
Source="Core"
StackTrace:
at Core.Mappings.ControlDictionary.GetControlType(Type type) in c:\cruisecontrolrb\projects\white\work\Core\Mappings\ControlDictionary.cs:line 100

But this also gives an exception, but in this case an invalid cast exception.

Should either of the two ways we've tried to get Window objects from the desktop work? If not, how do we get Window objects from the desktop? Or is getting Window objects not possible using the .Get method any anything other than an application object?

Please use Desktop.Instance.Windows() to get all the windows and then you can find the window which you are interested in.
I think I should make the error more clearer because Get<Window> would not work (or there should be a compile time error). Get is supposed to provide you only PrimaryUIItems, window is not a primary item.
Sorry about the lack of clarity. This should get fixed in next release.

viveksingh wrote:
Please use Desktop.Instance.Windows() to get all the windows and then you can find the window which you are interested in.
I think I should make the error more clearer because Get<Window> would not work (or there should be a compile time error). Get is supposed to provide you only PrimaryUIItems, window is not a primary item.
Sorry about the lack of clarity. This should get fixed in next release.