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
- XmlDataSourceView.cs
- SecureStringHasher.cs
- TabControl.cs
- InkCanvasAutomationPeer.cs
- CorrelationActionMessageFilter.cs
- ValidationRule.cs
- AutoResetEvent.cs
- PerfService.cs
- RootBrowserWindow.cs
- BuildResultCache.cs
- StrokeNodeEnumerator.cs
- CSharpCodeProvider.cs
- NameService.cs
- StrokeRenderer.cs
- XslCompiledTransform.cs
- WebPartConnectionsConnectVerb.cs
- PrimarySelectionGlyph.cs
- KnownBoxes.cs
- IndexObject.cs
- TemplateBindingExpression.cs
- DataBindingExpressionBuilder.cs
- ImageFormatConverter.cs
- ClientScriptManager.cs
- ModuleBuilderData.cs
- TypeConverterValueSerializer.cs
- EntityContainer.cs
- Int32RectValueSerializer.cs
- ReadContentAsBinaryHelper.cs
- TraceRecords.cs
- Pen.cs
- CalloutQueueItem.cs
- SortKey.cs
- UserControl.cs
- ThreadExceptionDialog.cs
- SizeConverter.cs
- MarkupExtensionSerializer.cs
- Translator.cs
- HostedBindingBehavior.cs
- Msec.cs
- DesignerValidatorAdapter.cs
- MobileControlsSectionHandler.cs
- FixedSOMTextRun.cs
- TableRowGroup.cs
- OptimalTextSource.cs
- NativeMethodsCLR.cs
- RNGCryptoServiceProvider.cs
- CodeTypeDelegate.cs
- TextEditorDragDrop.cs
- ButtonChrome.cs
- keycontainerpermission.cs
- CursorConverter.cs
- SurrogateDataContract.cs
- DeclarationUpdate.cs
- TcpAppDomainProtocolHandler.cs
- EllipseGeometry.cs
- TextureBrush.cs
- KnownIds.cs
- OdbcException.cs
- TransformerTypeCollection.cs
- ResourceAttributes.cs
- IndexingContentUnit.cs
- ExpandoObject.cs
- TextBoxBase.cs
- ProcessHostMapPath.cs
- QueryInterceptorAttribute.cs
- BitArray.cs
- ThreadAbortException.cs
- DefaultBinder.cs
- ConfigXmlSignificantWhitespace.cs
- DataRelation.cs
- Dispatcher.cs
- EncryptionUtility.cs
- DnsPermission.cs
- _NativeSSPI.cs
- ParseChildrenAsPropertiesAttribute.cs
- InputBinding.cs
- SessionEndingCancelEventArgs.cs
- CapiSymmetricAlgorithm.cs
- CollectionViewSource.cs
- CodeCatchClauseCollection.cs
- UnrecognizedPolicyAssertionElement.cs
- PolygonHotSpot.cs
- EdmError.cs
- ResourceReader.cs
- HttpHandlersSection.cs
- LazyTextWriterCreator.cs
- OracleConnectionStringBuilder.cs
- DesignerImageAdapter.cs
- ErrorStyle.cs
- GeometryModel3D.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- XamlReaderHelper.cs
- OrderedDictionary.cs
- ErrorRuntimeConfig.cs
- CircleHotSpot.cs
- SignatureDescription.cs
- DateTimeFormatInfoScanner.cs
- TableColumnCollectionInternal.cs
- DynamicDiscoSearcher.cs
- EventMappingSettings.cs