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
- LinearGradientBrush.cs
- Funcletizer.cs
- DesignTimeSiteMapProvider.cs
- QueryContinueDragEvent.cs
- MemberAssignmentAnalysis.cs
- Funcletizer.cs
- SqlDataSourceConnectionPanel.cs
- DbParameterHelper.cs
- UrlPath.cs
- PropertySourceInfo.cs
- ResourceContainer.cs
- DataGridColumnFloatingHeader.cs
- DispatchProxy.cs
- SHA512Managed.cs
- Attributes.cs
- CroppedBitmap.cs
- MatchNoneMessageFilter.cs
- SystemParameters.cs
- LineBreakRecord.cs
- CTreeGenerator.cs
- WebSysDefaultValueAttribute.cs
- DataGridCaption.cs
- DeflateEmulationStream.cs
- ProfessionalColors.cs
- DeclaredTypeValidatorAttribute.cs
- LoginAutoFormat.cs
- DocComment.cs
- Brush.cs
- GlyphTypeface.cs
- TabletDevice.cs
- XmlAnyElementAttribute.cs
- QueueException.cs
- ParserStreamGeometryContext.cs
- ScopeElementCollection.cs
- XmlIgnoreAttribute.cs
- RegexCharClass.cs
- DependencyPropertyConverter.cs
- WasEndpointConfigContainer.cs
- IdentitySection.cs
- MessageHeaderDescription.cs
- EventHandlersStore.cs
- AliasExpr.cs
- PartitionResolver.cs
- TypeUnloadedException.cs
- UInt32Converter.cs
- XmlObjectSerializerWriteContext.cs
- StatusBarPanelClickEvent.cs
- SqlColumnizer.cs
- AddInDeploymentState.cs
- MobileRedirect.cs
- ContainsRowNumberChecker.cs
- IgnoreSectionHandler.cs
- MediaElement.cs
- StronglyTypedResourceBuilder.cs
- ColorKeyFrameCollection.cs
- HtmlUtf8RawTextWriter.cs
- StringSource.cs
- CompilerGeneratedAttribute.cs
- ArrayWithOffset.cs
- WindowsButton.cs
- PrtTicket_Public_Simple.cs
- ParameterToken.cs
- TextBox.cs
- URL.cs
- ObjectManager.cs
- COM2ComponentEditor.cs
- RegexCompilationInfo.cs
- ToolStripHighContrastRenderer.cs
- Vector3DValueSerializer.cs
- Win32PrintDialog.cs
- NavigatingCancelEventArgs.cs
- ValidationEventArgs.cs
- Environment.cs
- DesignerSerializationOptionsAttribute.cs
- CodeGenerator.cs
- ResourceManagerWrapper.cs
- Group.cs
- _DisconnectOverlappedAsyncResult.cs
- KeyEventArgs.cs
- TransactionManager.cs
- DataSourceHelper.cs
- Parser.cs
- _OverlappedAsyncResult.cs
- CodeCatchClauseCollection.cs
- QueryOperationResponseOfT.cs
- DataGridCaption.cs
- CompilerGlobalScopeAttribute.cs
- Path.cs
- ToolStripItem.cs
- MetadataArtifactLoaderFile.cs
- CustomAttributeFormatException.cs
- DataControlFieldCell.cs
- EntitySetDataBindingList.cs
- CmsUtils.cs
- ParserExtension.cs
- OdbcConnectionPoolProviderInfo.cs
- ProjectedSlot.cs
- BoundColumn.cs
- XmlSerializerNamespaces.cs
- BaseTemplateBuildProvider.cs