Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / UIAutomation / Win32Providers / MS / Internal / AutomationProxies / SafeThemeHandle.cs / 1 / SafeThemeHandle.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // // History: // 10/04/2003 : [....] Created //--------------------------------------------------------------------------- using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; //using System.Runtime.CompilerServices; using System.Windows.Automation; using Microsoft.Win32.SafeHandles; using MS.Win32; namespace MS.Internal.AutomationProxies { internal sealed class SafeThemeHandle : SafeHandleZeroOrMinusOneIsInvalid { // This constructor is used by the P/Invoke marshaling layer // to allocate a SafeHandle instance. P/Invoke then does the // appropriate method call, storing the handle in this class. private SafeThemeHandle() : base(true) {} // Uncomment this if & only if we need a constructor // that takes a handle from external code internal SafeThemeHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(preexistingHandle); } // protected override bool ReleaseHandle() { // MustRun methods may only call other MustRun methods, // must not allocate along paths that must succeed, etc. return !IsInvalid ? CloseThemeData(handle) == (IntPtr)NativeMethods.S_OK : true; } [DllImport("UxTheme.dll", CharSet = CharSet.Auto)/*, SuppressUnmanagedCodeSecurity*/] // private static extern IntPtr CloseThemeData(IntPtr handle); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // // History: // 10/04/2003 : [....] Created //--------------------------------------------------------------------------- using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; //using System.Runtime.CompilerServices; using System.Windows.Automation; using Microsoft.Win32.SafeHandles; using MS.Win32; namespace MS.Internal.AutomationProxies { internal sealed class SafeThemeHandle : SafeHandleZeroOrMinusOneIsInvalid { // This constructor is used by the P/Invoke marshaling layer // to allocate a SafeHandle instance. P/Invoke then does the // appropriate method call, storing the handle in this class. private SafeThemeHandle() : base(true) {} // Uncomment this if & only if we need a constructor // that takes a handle from external code internal SafeThemeHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) { SetHandle(preexistingHandle); } // protected override bool ReleaseHandle() { // MustRun methods may only call other MustRun methods, // must not allocate along paths that must succeed, etc. return !IsInvalid ? CloseThemeData(handle) == (IntPtr)NativeMethods.S_OK : true; } [DllImport("UxTheme.dll", CharSet = CharSet.Auto)/*, SuppressUnmanagedCodeSecurity*/] // private static extern IntPtr CloseThemeData(IntPtr handle); } } // 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
- PolyBezierSegment.cs
- DialogResultConverter.cs
- SqlSelectStatement.cs
- DataGridHeaderBorder.cs
- GenerateScriptTypeAttribute.cs
- EditModeSwitchButton.cs
- ExtendedProtectionPolicy.cs
- DataSetMappper.cs
- WebColorConverter.cs
- MessageDecoder.cs
- QilDataSource.cs
- BulletedListDesigner.cs
- ExtentKey.cs
- Style.cs
- GridViewColumnCollectionChangedEventArgs.cs
- OleStrCAMarshaler.cs
- WindowVisualStateTracker.cs
- ShutDownListener.cs
- SelectionRange.cs
- CodeConditionStatement.cs
- PersonalizablePropertyEntry.cs
- StylusPointDescription.cs
- Int32Animation.cs
- XamlPoint3DCollectionSerializer.cs
- ResXBuildProvider.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- wgx_sdk_version.cs
- OdbcCommand.cs
- DataRecord.cs
- ComboBox.cs
- EasingKeyFrames.cs
- ImageFormatConverter.cs
- ErrorInfoXmlDocument.cs
- EntryWrittenEventArgs.cs
- StateItem.cs
- WSSecurityOneDotOneSendSecurityHeader.cs
- FixedPageStructure.cs
- StylusPointPropertyId.cs
- FrameworkElementFactory.cs
- TemplatedWizardStep.cs
- CustomPopupPlacement.cs
- DbProviderServices.cs
- BrushConverter.cs
- CodeCommentStatementCollection.cs
- Models.cs
- thaishape.cs
- Atom10ItemFormatter.cs
- ImageConverter.cs
- HwndMouseInputProvider.cs
- DependencyObjectType.cs
- ToolStripDropTargetManager.cs
- TargetControlTypeAttribute.cs
- ImageCollectionCodeDomSerializer.cs
- AnimationClockResource.cs
- FlowDocumentScrollViewer.cs
- ListBox.cs
- DependencyPropertyKind.cs
- QuaternionAnimationUsingKeyFrames.cs
- IdentityNotMappedException.cs
- UnmanagedMemoryStream.cs
- RectKeyFrameCollection.cs
- DirectoryObjectSecurity.cs
- DBParameter.cs
- TextEffectResolver.cs
- CacheVirtualItemsEvent.cs
- ModelVisual3D.cs
- oledbmetadatacollectionnames.cs
- XmlNodeComparer.cs
- BoolLiteral.cs
- DoubleLink.cs
- ServicePoint.cs
- RawStylusSystemGestureInputReport.cs
- SecurityContextTokenValidationException.cs
- WindowsListViewScroll.cs
- DataKey.cs
- RawKeyboardInputReport.cs
- ProtocolsConfigurationHandler.cs
- DbSetClause.cs
- ProtocolViolationException.cs
- WebServiceParameterData.cs
- CheckBoxFlatAdapter.cs
- ProjectionPathBuilder.cs
- DebugView.cs
- FontFaceLayoutInfo.cs
- LowerCaseStringConverter.cs
- PersistenceTypeAttribute.cs
- ComplexTypeEmitter.cs
- SafeFileMappingHandle.cs
- SafeNativeMethods.cs
- DataColumn.cs
- RoleService.cs
- TimeSpanOrInfiniteConverter.cs
- CqlWriter.cs
- LocalizedNameDescriptionPair.cs
- ClientCultureInfo.cs
- SaveFileDialog.cs
- DocumentDesigner.cs
- NativeBuffer.cs
- XmlReaderSettings.cs
- BindingCompleteEventArgs.cs