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
- ActiveDocumentEvent.cs
- RightNameExpirationInfoPair.cs
- RegexFCD.cs
- SimpleApplicationHost.cs
- CqlIdentifiers.cs
- DataServiceExpressionVisitor.cs
- XmlNodeList.cs
- HWStack.cs
- WebDisplayNameAttribute.cs
- IIS7UserPrincipal.cs
- MinimizableAttributeTypeConverter.cs
- TextDecoration.cs
- TextServicesPropertyRanges.cs
- ContainerAction.cs
- _HTTPDateParse.cs
- TargetConverter.cs
- HMACRIPEMD160.cs
- XmlTextReader.cs
- DrawingServices.cs
- ProcessingInstructionAction.cs
- MaterializeFromAtom.cs
- ISFClipboardData.cs
- XmlBinaryReader.cs
- HtmlTextArea.cs
- RoleGroupCollectionEditor.cs
- WithStatement.cs
- EdmToObjectNamespaceMap.cs
- XmlUnspecifiedAttribute.cs
- StructuralType.cs
- CompilerCollection.cs
- QilVisitor.cs
- OdbcRowUpdatingEvent.cs
- MetadataArtifactLoaderCompositeResource.cs
- FunctionCommandText.cs
- ProxyAssemblyNotLoadedException.cs
- UnauthorizedWebPart.cs
- EventMappingSettings.cs
- pingexception.cs
- OleDbWrapper.cs
- Menu.cs
- StringSource.cs
- DependencyPropertyKind.cs
- SecurityHelper.cs
- CTreeGenerator.cs
- SystemThemeKey.cs
- DataControlButton.cs
- MissingSatelliteAssemblyException.cs
- PreviewPrintController.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- FragmentNavigationEventArgs.cs
- SchemeSettingElementCollection.cs
- LongPath.cs
- NGCUIElementCollectionSerializerAsync.cs
- XAMLParseException.cs
- sqlpipe.cs
- ExecutionContext.cs
- EntityStoreSchemaFilterEntry.cs
- RectConverter.cs
- ColorPalette.cs
- DragSelectionMessageFilter.cs
- WebServiceParameterData.cs
- DBBindings.cs
- ModelPerspective.cs
- ToolStripContentPanel.cs
- FtpWebResponse.cs
- ActivityWithResultValueSerializer.cs
- documentsequencetextpointer.cs
- BatchWriter.cs
- WinFormsUtils.cs
- WmfPlaceableFileHeader.cs
- TriggerBase.cs
- TextEncodedRawTextWriter.cs
- ModelUIElement3D.cs
- TerminateDesigner.cs
- BinHexEncoding.cs
- TemplateParser.cs
- LicenseContext.cs
- UnsafeNativeMethodsCLR.cs
- CodeDelegateInvokeExpression.cs
- CharStorage.cs
- ModelEditingScope.cs
- MemoryFailPoint.cs
- _DisconnectOverlappedAsyncResult.cs
- SeverityFilter.cs
- XsdValidatingReader.cs
- Pipe.cs
- ContainerUIElement3D.cs
- TextBoxView.cs
- Vars.cs
- CompositeFontInfo.cs
- XmlName.cs
- TreeIterators.cs
- NetSectionGroup.cs
- RichTextBox.cs
- UserNamePasswordServiceCredential.cs
- ApplicationServiceManager.cs
- ListItem.cs
- WindowsRichEdit.cs
- SqlInternalConnectionTds.cs
- InputLanguageSource.cs