Hi all,
in the context of coded UI testing, I am trying to enumerate windows that have the desktop as their parent. I wrote the following code (this is the constructor of the UILoginWindow2 class which is derived from WinWindow):
public UILoginWindow2() { Trace.WriteLine(string.Format("Desktop HWND={0:X8}", (int)Desktop.WindowHandle)); UITestControlCollection desktopChildren = Desktop.GetChildren(); foreach (UITestControl desktopChild in desktopChildren) { Trace.WriteLine(string.Format("Desktop child HWND={0:X8}", (int)desktopChild.WindowHandle)); } }
Now I wonder why this creates the following output:
A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll Desktop HWND=00010010 A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.CrossBrowser.dll A first chance exception of type 'System.NotSupportedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll A first chance exception of type 'System.NotImplementedException' occurred in Microsoft.VisualStudio.TestTools.UITest.Extension.dll Desktop child HWND=00010010 Desktop child HWND=00010010 Desktop child HWND=00010010 Desktop child HWND=00010010 Desktop child HWND=00010010
Can anyone explain what I'm doing wrong? (I know that this code snippet does not contain useful code but I see no use in writing "real" code before the basics work...)
(Edit: The above output seems to indicate that all desktop children have the same HWND as the desktop itself, which cannot be correct. Either the code does not do what I want it to, or my interpretation of the output is wrong.)
Thanks
Hans