Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / AccessibleTech / longhorn / Automation / UIAutomationClient / MS / Internal / Automation / WindowShowOrOpenTracker.cs / 1 / WindowShowOrOpenTracker.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Class used to track new UI appearing and make sure any events // are propogated to that new UI. // // History: // 06/17/2003 : [....] Ported to WCP // 11/20/2003 : [....] renamed NewUITracker.cs to WindowShowOrOpenTracker.cs // //--------------------------------------------------------------------------- using System; using System.Globalization; using System.Text; using System.Windows.Automation; using System.Diagnostics; using MS.Win32; namespace MS.Internal.Automation { // WindowShowOrOpenTracker - Class used to track new UI appearing and make sure any events // are propogated to that new UI. internal delegate void WindowShowOrOpenHandler( IntPtr hwnd, AutomationElement rawEl ); // Class used to track new UI appearing and make sure any events // are propogated to that new UI. internal class WindowShowOrOpenTracker : WinEventWrap { //----------------------------------------------------- // // Constructors // //----------------------------------------------------- #region Constructors internal WindowShowOrOpenTracker(WindowShowOrOpenHandler newUIHandler) : base(new int[] {NativeMethods.EventObjectUIFragmentCreate, NativeMethods.EVENT_OBJECT_CREATE, NativeMethods.EVENT_OBJECT_SHOW}) { AddCallback(newUIHandler); } #endregion Constructors //------------------------------------------------------ // // Internal Methods // //----------------------------------------------------- #region Internal Methods internal override void WinEventProc(int eventId, IntPtr hwnd, int idObject, int idChild, uint eventTime) { // ignore any event not pertaining directly to the window if (idObject != UnsafeNativeMethods.OBJID_WINDOW) return; // Ignore if this is a bogus hwnd (shouldn't happen) if (hwnd == IntPtr.Zero) return; NativeMethods.HWND nativeHwnd = NativeMethods.HWND.Cast( hwnd ); // Ignore windows that have been destroyed if (! SafeNativeMethods.IsWindow( nativeHwnd )) return; // Ignore invisible windows (IsWindowVisible takes the hwnd ancestor // visibility into account) if (! SafeNativeMethods.IsWindowVisible( nativeHwnd )) return; if (eventId == NativeMethods.EVENT_OBJECT_CREATE) { // Ignore WCP hwnd creates; we get eventId EventObjectUIFragmentCreate for those // string str = ProxyManager.GetClassName(nativeHwnd); if (String.Compare(str, 0, _wcpClassName, 0, _wcpClassName.Length, StringComparison.OrdinalIgnoreCase) == 0) return; } AutomationElement rawEl = AutomationElement.FromHandle( hwnd ); // Do the notify. Note that this handler is used to notify client-side UIAutomation providers of windows // being destroyed or hidden. The delegate called here is itself protected by a lock. This delegate may // call out to proxies but also calls ClientEventManager.RaiseEventInThisClientOnly which properly // queues the actual callout to client code. object [] handlers = GetHandlers(); Debug.Assert(handlers.Length <= 1, "handlers.Length"); if (handlers.Length > 0) ((WindowShowOrOpenHandler)handlers[0])( hwnd, rawEl ); } #endregion Internal Methods //------------------------------------------------------ // // Private Fields // //------------------------------------------------------ #region Private Fields static readonly string _wcpClassName = "HwndWrapper"; #endregion Private Fields } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BufferedStream.cs
- MsmqOutputSessionChannel.cs
- WaitForChangedResult.cs
- BitmapMetadataEnumerator.cs
- DocComment.cs
- GcSettings.cs
- BinaryMessageFormatter.cs
- WebPartZoneCollection.cs
- DataKeyCollection.cs
- EqualityComparer.cs
- ExpressionsCollectionEditor.cs
- Tracer.cs
- RedirectionProxy.cs
- DigitShape.cs
- PrefixQName.cs
- _ContextAwareResult.cs
- InputMethodStateChangeEventArgs.cs
- ObjRef.cs
- XmlAttributeCache.cs
- ScriptControl.cs
- ProtocolsSection.cs
- ItemCollection.cs
- ActivityPreviewDesigner.cs
- MulticastNotSupportedException.cs
- LoggedException.cs
- FixedElement.cs
- NonBatchDirectoryCompiler.cs
- CmsUtils.cs
- WSHttpTransportSecurityElement.cs
- PageParser.cs
- FileVersionInfo.cs
- JpegBitmapDecoder.cs
- ProjectionCamera.cs
- controlskin.cs
- StructuralComparisons.cs
- ReferentialConstraint.cs
- AssemblyAssociatedContentFileAttribute.cs
- WindowsSpinner.cs
- DeferredReference.cs
- LogReserveAndAppendState.cs
- PeerNearMe.cs
- GridSplitter.cs
- UriSection.cs
- CellTreeNode.cs
- XmlSerializerFactory.cs
- DecoderBestFitFallback.cs
- FormatVersion.cs
- Internal.cs
- AsnEncodedData.cs
- DBNull.cs
- SamlEvidence.cs
- LabelLiteral.cs
- ListenerHandler.cs
- XmlSerializationGeneratedCode.cs
- RowUpdatingEventArgs.cs
- WhitespaceRuleLookup.cs
- TemplateEditingVerb.cs
- BmpBitmapDecoder.cs
- DbConnectionPoolOptions.cs
- ReceiveActivityValidator.cs
- RuntimeConfigurationRecord.cs
- LoginName.cs
- WebBrowserNavigatedEventHandler.cs
- DataGridViewRow.cs
- CustomSignedXml.cs
- XmlRootAttribute.cs
- ExternalException.cs
- BinaryCommonClasses.cs
- CommentGlyph.cs
- WindowsListViewGroupSubsetLink.cs
- EvidenceTypeDescriptor.cs
- SystemColors.cs
- InkSerializer.cs
- ExtenderControl.cs
- DbProviderFactories.cs
- Single.cs
- PageOutputColor.cs
- ItemCheckedEvent.cs
- HttpValueCollection.cs
- DispatcherHooks.cs
- CodeConditionStatement.cs
- SpStreamWrapper.cs
- FlowLayoutSettings.cs
- ProxyHwnd.cs
- Switch.cs
- XmlSubtreeReader.cs
- CommandField.cs
- XmlSchemaComplexContent.cs
- WebPartEditorApplyVerb.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- BamlLocalizableResource.cs
- BuildResult.cs
- ApplicationDirectoryMembershipCondition.cs
- QueryStringHandler.cs
- XmlDataImplementation.cs
- ServerIdentity.cs
- DocumentGrid.cs
- SoapExtensionImporter.cs
- CommandLineParser.cs
- oledbmetadatacollectionnames.cs