Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- PrimaryKeyTypeConverter.cs
- HttpChannelBindingToken.cs
- KeyInstance.cs
- RelationshipConstraintValidator.cs
- FontFamily.cs
- DataGridItemCollection.cs
- ThemeDirectoryCompiler.cs
- arabicshape.cs
- AccessibleObject.cs
- ExpressionPrinter.cs
- TraceContextEventArgs.cs
- Timer.cs
- XamlReaderHelper.cs
- BufferedGraphics.cs
- CustomValidator.cs
- WriterOutput.cs
- AdornerPresentationContext.cs
- TextTreeTextBlock.cs
- ChtmlTextWriter.cs
- _NativeSSPI.cs
- ADConnectionHelper.cs
- SystemEvents.cs
- ResourceReader.cs
- CacheSection.cs
- NegationPusher.cs
- DiscreteKeyFrames.cs
- HtmlSelect.cs
- UniqueEventHelper.cs
- LOSFormatter.cs
- HtmlShim.cs
- ConfigurationValue.cs
- BaseValidator.cs
- TabPageDesigner.cs
- FigureParagraph.cs
- Thumb.cs
- Point3DCollection.cs
- XmlAnyElementAttribute.cs
- Metafile.cs
- HandleRef.cs
- DockAndAnchorLayout.cs
- __ComObject.cs
- ListBoxItem.cs
- MdiWindowListStrip.cs
- PrimitiveSchema.cs
- BasePropertyDescriptor.cs
- MsmqTransportReceiveParameters.cs
- StoreContentChangedEventArgs.cs
- XamlFigureLengthSerializer.cs
- DSACryptoServiceProvider.cs
- HtmlWindowCollection.cs
- DataGrid.cs
- tooltip.cs
- SafeFileHandle.cs
- AssemblyEvidenceFactory.cs
- DataGridItem.cs
- AllMembershipCondition.cs
- Lease.cs
- AuthorizationSection.cs
- FixedDocumentPaginator.cs
- CardSpaceShim.cs
- PrinterResolution.cs
- SafeEventLogReadHandle.cs
- GeometryConverter.cs
- Clipboard.cs
- DynamicRendererThreadManager.cs
- NativeMethods.cs
- StorageMappingItemLoader.cs
- CultureInfoConverter.cs
- If.cs
- InternalBase.cs
- ScrollProperties.cs
- DataGridViewComboBoxColumn.cs
- ListViewGroup.cs
- ToolBarButtonClickEvent.cs
- Mouse.cs
- sqlmetadatafactory.cs
- AnonymousIdentificationSection.cs
- Soap11ServerProtocol.cs
- TableAdapterManagerHelper.cs
- ProviderException.cs
- COAUTHIDENTITY.cs
- DataGridViewCellValueEventArgs.cs
- CommandPlan.cs
- DbConnectionInternal.cs
- XmlDocumentType.cs
- GridViewDesigner.cs
- XmlEncodedRawTextWriter.cs
- BitmapImage.cs
- FixedLineResult.cs
- AsnEncodedData.cs
- ConnectionManagementSection.cs
- ServiceBuildProvider.cs
- odbcmetadatacolumnnames.cs
- MessageSecurityOverMsmqElement.cs
- Directory.cs
- Mapping.cs
- StylusButtonCollection.cs
- GradientSpreadMethodValidation.cs
- EntityDataSourceMemberPath.cs
- XmlSiteMapProvider.cs