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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Stack.cs
- HwndKeyboardInputProvider.cs
- SchemaElement.cs
- DataGridViewColumnConverter.cs
- DataGridCaption.cs
- XmlDataSourceNodeDescriptor.cs
- TabletDeviceInfo.cs
- TypeCacheManager.cs
- ToolBar.cs
- Pen.cs
- ListItemCollection.cs
- EntityDataSourceUtil.cs
- Compiler.cs
- EdmSchemaAttribute.cs
- MemoryMappedViewAccessor.cs
- webproxy.cs
- BamlLocalizabilityResolver.cs
- LayoutTableCell.cs
- GreenMethods.cs
- DiscoveryClientChannelFactory.cs
- WebExceptionStatus.cs
- CompilationUnit.cs
- SqlProcedureAttribute.cs
- SessionIDManager.cs
- SystemFonts.cs
- ForeignConstraint.cs
- WebPartConnectionsConfigureVerb.cs
- PerspectiveCamera.cs
- ProcessHostMapPath.cs
- ThreadStartException.cs
- WCFServiceClientProxyGenerator.cs
- Geometry3D.cs
- KoreanCalendar.cs
- BitArray.cs
- FileAccessException.cs
- ComplexBindingPropertiesAttribute.cs
- HttpApplicationFactory.cs
- GridViewRow.cs
- EdmMember.cs
- Typeface.cs
- ObjectItemAssemblyLoader.cs
- DataGridViewCellLinkedList.cs
- Int32AnimationUsingKeyFrames.cs
- ObjectStateManagerMetadata.cs
- ContextMenuStrip.cs
- Registry.cs
- AxHost.cs
- EventLevel.cs
- QueryableDataSource.cs
- AttachedPropertyMethodSelector.cs
- DataShape.cs
- XmlCharType.cs
- DesignerActionGlyph.cs
- Point3DCollectionConverter.cs
- GridView.cs
- PersonalizationAdministration.cs
- HttpStreamXmlDictionaryWriter.cs
- ApplicationInfo.cs
- UnsafeNativeMethodsPenimc.cs
- DocumentStream.cs
- WebRequestModuleElement.cs
- StreamWriter.cs
- DurableDispatcherAddressingFault.cs
- InputMethodStateTypeInfo.cs
- XamlSerializationHelper.cs
- ProfileProvider.cs
- HtmlForm.cs
- BasicKeyConstraint.cs
- Visitor.cs
- XsdValidatingReader.cs
- ReadContentAsBinaryHelper.cs
- UrlPath.cs
- _StreamFramer.cs
- HtmlElementErrorEventArgs.cs
- OperatingSystem.cs
- UIElementParagraph.cs
- XamlFilter.cs
- SafeFindHandle.cs
- Descriptor.cs
- LocalBuilder.cs
- DocumentReference.cs
- TemplatedAdorner.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- UIElementHelper.cs
- DockPattern.cs
- HtmlLink.cs
- CodeTypeOfExpression.cs
- IResourceProvider.cs
- SimpleFieldTemplateFactory.cs
- AnnotationMap.cs
- DataListItemEventArgs.cs
- BlurBitmapEffect.cs
- xmlglyphRunInfo.cs
- XmlNodeChangedEventArgs.cs
- APCustomTypeDescriptor.cs
- Asn1IntegerConverter.cs
- ListBox.cs
- Rotation3D.cs
- CalendarAutoFormatDialog.cs
- SizeAnimationUsingKeyFrames.cs