Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Interop / WindowInteropHelper.cs / 1 / WindowInteropHelper.cs
//---------------------------------------------------------------------------- // // File: WindowInteropHelper.cs // // Description: Implements Avalon WindowInteropHelper classes, which helps // interop b/w legacy and Avalon Window. // // Created: 05/06/03 // // Copyright (C) 2001 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Interop; using System.Security; using System.Security.Permissions; using System.Diagnostics; using MS.Internal; using MS.Internal.PresentationFramework; // SecurityHelper using MS.Win32; namespace System.Windows.Interop { #region class WindowInteropHelper ////// Implements Avalon WindowInteropHelper classes, which helps /// interop b/w legacy and Avalon Window. /// public sealed class WindowInteropHelper { //--------------------------------------------------- // // Constructors // //--------------------------------------------------- #region Constructors ////// /// /// public WindowInteropHelper(Window window) { if (window == null) throw new ArgumentNullException("window"); _window = window; } #endregion Constructors //---------------------------------------------------- // // Public Properties // //--------------------------------------------------- #region Public Properties ////// Get the Handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Handle { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); return CriticalHandle; } } ////// Critical: Exposes a handle /// internal IntPtr CriticalHandle { [SecurityCritical] get { Invariant.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.CriticalHandle; } } ////// Get/Set the Owner handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Owner { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.OwnerHandle; } [SecurityCritical] set { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); // error checking done in Window _window.OwnerHandle = value; } } #endregion Public Properties //---------------------------------------------- // // Private Fields // //---------------------------------------------- #region Private Fields private Window _window; #endregion Private Members } #endregion class WindowInteropHelper } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: WindowInteropHelper.cs // // Description: Implements Avalon WindowInteropHelper classes, which helps // interop b/w legacy and Avalon Window. // // Created: 05/06/03 // // Copyright (C) 2001 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Interop; using System.Security; using System.Security.Permissions; using System.Diagnostics; using MS.Internal; using MS.Internal.PresentationFramework; // SecurityHelper using MS.Win32; namespace System.Windows.Interop { #region class WindowInteropHelper ////// Implements Avalon WindowInteropHelper classes, which helps /// interop b/w legacy and Avalon Window. /// public sealed class WindowInteropHelper { //--------------------------------------------------- // // Constructors // //--------------------------------------------------- #region Constructors ////// /// /// public WindowInteropHelper(Window window) { if (window == null) throw new ArgumentNullException("window"); _window = window; } #endregion Constructors //---------------------------------------------------- // // Public Properties // //--------------------------------------------------- #region Public Properties ////// Get the Handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Handle { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); return CriticalHandle; } } ////// Critical: Exposes a handle /// internal IntPtr CriticalHandle { [SecurityCritical] get { Invariant.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.CriticalHandle; } } ////// Get/Set the Owner handle of the window /// ////// Callers must have UIPermission(UIPermissionWindow.AllWindows) to call this API. /// ////// Critical: Exposes a handle /// PublicOK: There is a demand , this API not available in internet zone /// public IntPtr Owner { [SecurityCritical] get { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); return _window.OwnerHandle; } [SecurityCritical] set { SecurityHelper.DemandUIWindowPermission(); Debug.Assert(_window != null, "Cannot be null since we verify in the constructor"); // error checking done in Window _window.OwnerHandle = value; } } #endregion Public Properties //---------------------------------------------- // // Private Fields // //---------------------------------------------- #region Private Fields private Window _window; #endregion Private Members } #endregion class WindowInteropHelper } // 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
- TcpServerChannel.cs
- StateChangeEvent.cs
- ValidationUtility.cs
- PenContext.cs
- ImportContext.cs
- PeerNode.cs
- ArrangedElement.cs
- VirtualDirectoryMapping.cs
- HostUtils.cs
- SqlReferenceCollection.cs
- InternalSafeNativeMethods.cs
- ListControlBuilder.cs
- SqlServices.cs
- PointValueSerializer.cs
- TabControlCancelEvent.cs
- ParseNumbers.cs
- TabItem.cs
- DispatcherTimer.cs
- KeyFrames.cs
- ContentFileHelper.cs
- Run.cs
- ConfigurationValidatorBase.cs
- MultiBinding.cs
- ProviderSettings.cs
- SourceSwitch.cs
- LinkTarget.cs
- NavigationWindow.cs
- RegexStringValidatorAttribute.cs
- IntellisenseTextBox.designer.cs
- SafeNativeMethodsMilCoreApi.cs
- ProxyWebPart.cs
- XmlBinaryReader.cs
- MatrixTransform3D.cs
- ValidationErrorCollection.cs
- ObjectSecurity.cs
- CodeThrowExceptionStatement.cs
- ApplicationDirectory.cs
- ResourceSet.cs
- RoutedEventHandlerInfo.cs
- DbConnectionOptions.cs
- baseaxisquery.cs
- MethodAccessException.cs
- ToolStripButton.cs
- WebPartsSection.cs
- FixUpCollection.cs
- SecureEnvironment.cs
- EventLogTraceListener.cs
- CapabilitiesSection.cs
- UnknownBitmapDecoder.cs
- CharEntityEncoderFallback.cs
- XPSSignatureDefinition.cs
- ipaddressinformationcollection.cs
- ListViewGroup.cs
- ChangePasswordAutoFormat.cs
- ClientUtils.cs
- MeshGeometry3D.cs
- ValidatingCollection.cs
- StorageRoot.cs
- ListenerElementsCollection.cs
- GeometryHitTestParameters.cs
- Int64KeyFrameCollection.cs
- DataGridViewImageCell.cs
- RC2.cs
- MapPathBasedVirtualPathProvider.cs
- AutoResetEvent.cs
- SafeFileMappingHandle.cs
- UInt32.cs
- SqlFunctionAttribute.cs
- StreamWithDictionary.cs
- PropertyItemInternal.cs
- GlyphRun.cs
- HGlobalSafeHandle.cs
- ResetableIterator.cs
- elementinformation.cs
- StaticSiteMapProvider.cs
- CompatibleIComparer.cs
- PermissionToken.cs
- HttpDateParse.cs
- baseaxisquery.cs
- ViewEvent.cs
- MgmtConfigurationRecord.cs
- CompModHelpers.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- Line.cs
- SamlAttribute.cs
- GridView.cs
- SamlSubjectStatement.cs
- VisemeEventArgs.cs
- ExtensionFile.cs
- CodeArrayCreateExpression.cs
- BitmapEffectInputData.cs
- DriveInfo.cs
- ProvidersHelper.cs
- ArrayElementGridEntry.cs
- OletxResourceManager.cs
- HandlerBase.cs
- HtmlInputHidden.cs
- InternalRelationshipCollection.cs
- XmlFileEditor.cs
- InstanceData.cs