Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / OleStrCAMarshaler.cs / 1 / OleStrCAMarshaler.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ComponentModel.Com2Interop { using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System; ////// /// This class performs marshaling on a CALPOLESTR struct given /// from native code. /// internal class OleStrCAMarshaler: BaseCAMarshaler { public OleStrCAMarshaler(NativeMethods.CA_STRUCT caAddr) : base(caAddr) { } ////// /// Returns the type of item this marshaler will /// return in the items array. In this case, the type is string. /// public override Type ItemType { get { return typeof(string); } } protected override Array CreateArray() { return new string[Count]; } ////// /// Override this member to perform marshalling of a single item /// given it's native address. /// protected override object GetItemFromAddress(IntPtr addr) { string item = Marshal.PtrToStringUni(addr); // free the memory Marshal.FreeCoTaskMem(addr); return item; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms.ComponentModel.Com2Interop { using System.Runtime.InteropServices; using System.ComponentModel; using System.Diagnostics; using System; ////// /// This class performs marshaling on a CALPOLESTR struct given /// from native code. /// internal class OleStrCAMarshaler: BaseCAMarshaler { public OleStrCAMarshaler(NativeMethods.CA_STRUCT caAddr) : base(caAddr) { } ////// /// Returns the type of item this marshaler will /// return in the items array. In this case, the type is string. /// public override Type ItemType { get { return typeof(string); } } protected override Array CreateArray() { return new string[Count]; } ////// /// Override this member to perform marshalling of a single item /// given it's native address. /// protected override object GetItemFromAddress(IntPtr addr) { string item = Marshal.PtrToStringUni(addr); // free the memory Marshal.FreeCoTaskMem(addr); return item; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebScriptEnablingElement.cs
- MetaChildrenColumn.cs
- HtmlControlPersistable.cs
- SecurityException.cs
- ObjectStateEntryDbDataRecord.cs
- ItemPager.cs
- Formatter.cs
- XmlSchemaObjectCollection.cs
- GZipDecoder.cs
- ExtendedPropertyDescriptor.cs
- Stack.cs
- IpcClientManager.cs
- GlyphShapingProperties.cs
- ControlParameter.cs
- MarkupExtensionReturnTypeAttribute.cs
- GradientSpreadMethodValidation.cs
- SizeAnimationUsingKeyFrames.cs
- CollectionDataContractAttribute.cs
- DataListItemCollection.cs
- Assert.cs
- RNGCryptoServiceProvider.cs
- SqlPersonalizationProvider.cs
- BaseTemplateParser.cs
- RowCache.cs
- ReplacementText.cs
- KnownBoxes.cs
- HTTPNotFoundHandler.cs
- TextEffectResolver.cs
- DebuggerAttributes.cs
- SystemParameters.cs
- MetadataArtifactLoaderCompositeResource.cs
- BaseParagraph.cs
- MediaContextNotificationWindow.cs
- ScalarConstant.cs
- BorderGapMaskConverter.cs
- DispatchChannelSink.cs
- ProfileManager.cs
- ListBox.cs
- InvokeHandlers.cs
- DateTimeValueSerializer.cs
- WorkerRequest.cs
- TemplateNodeContextMenu.cs
- PlainXmlWriter.cs
- ParserExtension.cs
- PropertyValueChangedEvent.cs
- VariableQuery.cs
- ControlLocalizer.cs
- ZipIOBlockManager.cs
- WebPartEditorApplyVerb.cs
- Utils.cs
- Color.cs
- DesignerFrame.cs
- HttpInputStream.cs
- DoubleAnimationBase.cs
- HashAlgorithm.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- LayoutInformation.cs
- RequestCache.cs
- XmlC14NWriter.cs
- WeakReadOnlyCollection.cs
- ObjectContext.cs
- HeaderUtility.cs
- XamlStream.cs
- EntityDataSourceWrapper.cs
- XmlSchemaFacet.cs
- GlobalAllocSafeHandle.cs
- ValidatorCompatibilityHelper.cs
- FixedSOMLineCollection.cs
- SystemDiagnosticsSection.cs
- InternalPolicyElement.cs
- EventListener.cs
- KernelTypeValidation.cs
- ThreadStartException.cs
- SHA1CryptoServiceProvider.cs
- ClientSettings.cs
- SaveFileDialog.cs
- SubclassTypeValidatorAttribute.cs
- FrameworkElementAutomationPeer.cs
- DecoderBestFitFallback.cs
- XmlComment.cs
- itemelement.cs
- ContentControl.cs
- ServiceManager.cs
- WindowsPen.cs
- hresults.cs
- CaseKeyBox.ViewModel.cs
- SecureUICommand.cs
- HashCoreRequest.cs
- ClusterSafeNativeMethods.cs
- DirtyTextRange.cs
- CfgSemanticTag.cs
- DeferredElementTreeState.cs
- RequestCachePolicyConverter.cs
- RegexCode.cs
- FilteredAttributeCollection.cs
- SchemaImporterExtensionsSection.cs
- SeekStoryboard.cs
- SiteIdentityPermission.cs
- OperationBehaviorAttribute.cs
- ColorDialog.cs