Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / OleStrCAMarshaler.cs / 1305376 / 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
- SettingsPropertyValue.cs
- DefaultPrintController.cs
- TextPatternIdentifiers.cs
- GridViewCommandEventArgs.cs
- DoubleAnimationBase.cs
- KeyGestureConverter.cs
- InputLanguageProfileNotifySink.cs
- XmlNodeList.cs
- Socket.cs
- RichTextBoxConstants.cs
- BindingSource.cs
- GraphicsContainer.cs
- DataGridViewRowConverter.cs
- LineGeometry.cs
- Configuration.cs
- SizeAnimationUsingKeyFrames.cs
- FormViewInsertedEventArgs.cs
- ActiveXContainer.cs
- RoleManagerEventArgs.cs
- TreeBuilderXamlTranslator.cs
- StringDictionaryWithComparer.cs
- ThreadStateException.cs
- Lease.cs
- FileLevelControlBuilderAttribute.cs
- Environment.cs
- ServiceNameCollection.cs
- GZipStream.cs
- CollectionBase.cs
- ChannelCacheDefaults.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- Exceptions.cs
- XPathAncestorQuery.cs
- LinkUtilities.cs
- ViewManagerAttribute.cs
- StreamingContext.cs
- VisualBrush.cs
- DesignUtil.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- ServiceOperationParameter.cs
- DefaultPrintController.cs
- SoundPlayer.cs
- SchemaTypeEmitter.cs
- ConnectivityStatus.cs
- TextHidden.cs
- CodeSnippetExpression.cs
- ValidationEventArgs.cs
- InputLanguageEventArgs.cs
- VisualTransition.cs
- FileEnumerator.cs
- Int16AnimationUsingKeyFrames.cs
- CrossAppDomainChannel.cs
- GlyphRunDrawing.cs
- EmptyEnumerator.cs
- SamlAuthorityBinding.cs
- DataGridViewCellEventArgs.cs
- PhysicalFontFamily.cs
- WindowsListViewSubItem.cs
- _HeaderInfo.cs
- FrameworkPropertyMetadata.cs
- ApplicationException.cs
- DataConnectionHelper.cs
- DataMemberFieldConverter.cs
- DataServiceProviderMethods.cs
- SafeNativeMethods.cs
- TreeNodeStyle.cs
- RuleInfoComparer.cs
- DelegatingTypeDescriptionProvider.cs
- DataExpression.cs
- DBNull.cs
- EdmPropertyAttribute.cs
- UnknownWrapper.cs
- mansign.cs
- ArgumentException.cs
- FeatureManager.cs
- Enum.cs
- ToolStripItemGlyph.cs
- BitArray.cs
- DerivedKeySecurityTokenStub.cs
- CryptoStream.cs
- SqlConnectionFactory.cs
- MultiPropertyDescriptorGridEntry.cs
- Bind.cs
- SortDescription.cs
- MULTI_QI.cs
- SBCSCodePageEncoding.cs
- AnimationStorage.cs
- SoapSchemaExporter.cs
- COM2Enum.cs
- XamlReader.cs
- ReservationCollection.cs
- XmlImplementation.cs
- DocumentsTrace.cs
- Simplifier.cs
- ThreadExceptionEvent.cs
- BitmapEffectInputConnector.cs
- XamlBrushSerializer.cs
- OrthographicCamera.cs
- SecurityUniqueId.cs
- Icon.cs
- WebControlAdapter.cs