Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- FieldBuilder.cs
- Inflater.cs
- CreateUserErrorEventArgs.cs
- SortKey.cs
- RandomNumberGenerator.cs
- WeakReferenceList.cs
- CommandID.cs
- DesignerActionKeyboardBehavior.cs
- SessionPageStateSection.cs
- ClientOptions.cs
- ModelUIElement3D.cs
- ListManagerBindingsCollection.cs
- DataGridViewAccessibleObject.cs
- XmlTextReader.cs
- FacetValueContainer.cs
- OdbcInfoMessageEvent.cs
- NameNode.cs
- SecurityHelper.cs
- ListViewContainer.cs
- TransformDescriptor.cs
- DropShadowEffect.cs
- ExtentCqlBlock.cs
- Int32Converter.cs
- TableLayoutStyleCollection.cs
- Int32.cs
- Speller.cs
- FlowDocument.cs
- LinkGrep.cs
- D3DImage.cs
- Logging.cs
- XmlText.cs
- BufferBuilder.cs
- __ConsoleStream.cs
- HtmlInputButton.cs
- ViewCellRelation.cs
- SecuritySessionServerSettings.cs
- XmlSchemaObject.cs
- FocusWithinProperty.cs
- ProcessModuleCollection.cs
- ApplicationContext.cs
- FlowDocument.cs
- ContextStack.cs
- BuildManagerHost.cs
- HTTPNotFoundHandler.cs
- ProtocolsConfiguration.cs
- BookmarkUndoUnit.cs
- BooleanFunctions.cs
- RealizationDrawingContextWalker.cs
- ToolStripStatusLabel.cs
- DataSpaceManager.cs
- SqlStream.cs
- GlyphRunDrawing.cs
- StrokeNode.cs
- ZipIOExtraFieldPaddingElement.cs
- SystemResources.cs
- ChangePasswordAutoFormat.cs
- ServiceMoniker.cs
- odbcmetadatafactory.cs
- StringUtil.cs
- CommunicationObjectFaultedException.cs
- ThreadStateException.cs
- PipelineModuleStepContainer.cs
- Win32NamedPipes.cs
- InputLanguageCollection.cs
- Psha1DerivedKeyGenerator.cs
- DecoderExceptionFallback.cs
- DataRelation.cs
- precedingsibling.cs
- ConfigurationValidatorAttribute.cs
- EncryptedType.cs
- Misc.cs
- CheckBoxBaseAdapter.cs
- ActivityValidationServices.cs
- MessageSmuggler.cs
- RelatedPropertyManager.cs
- PagesChangedEventArgs.cs
- MSHTMLHost.cs
- MutexSecurity.cs
- _HeaderInfo.cs
- UIElementAutomationPeer.cs
- validation.cs
- MessageEncoderFactory.cs
- LinqDataSourceSelectEventArgs.cs
- TypeTypeConverter.cs
- ContentPlaceHolder.cs
- SBCSCodePageEncoding.cs
- QualificationDataItem.cs
- ControlCachePolicy.cs
- SchemaElementDecl.cs
- PageThemeBuildProvider.cs
- ServiceHttpHandlerFactory.cs
- TextAnchor.cs
- RangeBase.cs
- DesignerOptionService.cs
- SoapElementAttribute.cs
- SpecularMaterial.cs
- TreeNodeBinding.cs
- EmptyQuery.cs
- DataExpression.cs
- RemotingConfiguration.cs