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
- HttpListenerRequestUriBuilder.cs
- TrustManagerPromptUI.cs
- NavigationProgressEventArgs.cs
- TypeBuilder.cs
- sapiproxy.cs
- ColorTranslator.cs
- ComplexLine.cs
- ExeConfigurationFileMap.cs
- GiveFeedbackEventArgs.cs
- ListDictionaryInternal.cs
- XmlChildEnumerator.cs
- ClientConvert.cs
- CqlParserHelpers.cs
- RuntimeWrappedException.cs
- SystemColors.cs
- PseudoWebRequest.cs
- ChangeConflicts.cs
- Visual3D.cs
- FormatVersion.cs
- ProtocolsConfigurationHandler.cs
- ReferenceTypeElement.cs
- FilePresentation.cs
- EndPoint.cs
- SafeEventLogReadHandle.cs
- EntityObject.cs
- XmlLinkedNode.cs
- WindowsIdentity.cs
- TextBox.cs
- DesignerActionHeaderItem.cs
- ServiceProviders.cs
- PeerUnsafeNativeMethods.cs
- GlobalizationSection.cs
- CroppedBitmap.cs
- TreeSet.cs
- HostingEnvironment.cs
- SystemResourceKey.cs
- EntityDataSourceWrapper.cs
- DynamicDataRoute.cs
- WorkflowTransactionOptions.cs
- DecoderFallback.cs
- TraceSection.cs
- XPathScanner.cs
- PrintDocument.cs
- DataGridViewImageColumn.cs
- OleStrCAMarshaler.cs
- Geometry3D.cs
- SoapAttributes.cs
- wgx_sdk_version.cs
- ComponentSerializationService.cs
- DocumentOrderQuery.cs
- ViewGenerator.cs
- NetSectionGroup.cs
- Mutex.cs
- EnumBuilder.cs
- ClientSettingsProvider.cs
- FtpRequestCacheValidator.cs
- MsmqInputSessionChannel.cs
- ReachNamespaceInfo.cs
- LinearGradientBrush.cs
- Literal.cs
- OleStrCAMarshaler.cs
- PrintPageEvent.cs
- CanExecuteRoutedEventArgs.cs
- InfoCardKeyedHashAlgorithm.cs
- Canvas.cs
- TdsEnums.cs
- documentsequencetextpointer.cs
- DeviceContext2.cs
- PartitionerStatic.cs
- RepeaterCommandEventArgs.cs
- ServiceEndpointAssociationProvider.cs
- _Win32.cs
- SettingsBindableAttribute.cs
- QueryableDataSourceEditData.cs
- DbExpressionBuilder.cs
- MeshGeometry3D.cs
- HwndSubclass.cs
- PackagePart.cs
- InheritanceRules.cs
- FlowLayoutSettings.cs
- ProxyWebPartManager.cs
- DataStorage.cs
- TaskbarItemInfo.cs
- MetadataItem_Static.cs
- MatrixAnimationBase.cs
- ConfigurationStrings.cs
- ThemeInfoAttribute.cs
- XamlFxTrace.cs
- AliasGenerator.cs
- ProjectionCamera.cs
- xmlglyphRunInfo.cs
- TearOffProxy.cs
- ConnectivityStatus.cs
- XmlQueryTypeFactory.cs
- Constraint.cs
- StoreContentChangedEventArgs.cs
- XmlMembersMapping.cs
- PublisherMembershipCondition.cs
- ObservableCollection.cs
- TextFormatterHost.cs