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
- SystemTcpConnection.cs
- StylusButton.cs
- RMEnrollmentPage3.cs
- DrawingAttributes.cs
- RegexCompiler.cs
- DefaultObjectSerializer.cs
- AppDomainCompilerProxy.cs
- ByteFacetDescriptionElement.cs
- DataConnectionHelper.cs
- GlobalProxySelection.cs
- LinkLabel.cs
- QualificationDataItem.cs
- PopupControlService.cs
- basevalidator.cs
- RuntimeConfig.cs
- StrokeDescriptor.cs
- SBCSCodePageEncoding.cs
- ListDataHelper.cs
- _DigestClient.cs
- ProvidePropertyAttribute.cs
- SplashScreen.cs
- HwndProxyElementProvider.cs
- webclient.cs
- XmlAttributeCollection.cs
- sqlmetadatafactory.cs
- StreamBodyWriter.cs
- Mouse.cs
- TabControlEvent.cs
- PropertyGeneratedEventArgs.cs
- ProxyFragment.cs
- DbConnectionPoolCounters.cs
- PartialCachingAttribute.cs
- HijriCalendar.cs
- HashAlgorithm.cs
- ListViewGroupConverter.cs
- SignatureGenerator.cs
- Geometry.cs
- ArrayTypeMismatchException.cs
- ECDsaCng.cs
- mediaeventargs.cs
- PlatformCulture.cs
- GridViewUpdatedEventArgs.cs
- HuffmanTree.cs
- XmlSignificantWhitespace.cs
- AccessViolationException.cs
- AuthenticationService.cs
- DataSpaceManager.cs
- InstanceKeyView.cs
- ReadOnlyHierarchicalDataSourceView.cs
- WhereaboutsReader.cs
- connectionpool.cs
- MetadataException.cs
- ToolStripItemTextRenderEventArgs.cs
- RangeValueProviderWrapper.cs
- ItemCollection.cs
- MapPathBasedVirtualPathProvider.cs
- RenderData.cs
- _LocalDataStore.cs
- ReflectionUtil.cs
- ExceptionHelpers.cs
- X509SecurityToken.cs
- AsymmetricSecurityProtocolFactory.cs
- DataTablePropertyDescriptor.cs
- Brush.cs
- EntitySetRetriever.cs
- XmlReflectionMember.cs
- Triangle.cs
- StringPropertyBuilder.cs
- SynchronizingStream.cs
- PathNode.cs
- InputLanguageProfileNotifySink.cs
- ObjectReaderCompiler.cs
- MemberAccessException.cs
- CultureInfo.cs
- COM2Properties.cs
- _CommandStream.cs
- SemanticValue.cs
- PackageDigitalSignature.cs
- GenericQueueSurrogate.cs
- ImageConverter.cs
- SqlCacheDependencyDatabaseCollection.cs
- DocumentXPathNavigator.cs
- XmlWhitespace.cs
- CodeTypeMemberCollection.cs
- DragDrop.cs
- RegisteredArrayDeclaration.cs
- DataGridViewRowPostPaintEventArgs.cs
- XhtmlBasicValidationSummaryAdapter.cs
- DrawingContextWalker.cs
- DispatchChannelSink.cs
- NotificationContext.cs
- VideoDrawing.cs
- Soap12ProtocolReflector.cs
- TextServicesCompartment.cs
- CustomValidator.cs
- BooleanAnimationBase.cs
- StoragePropertyMapping.cs
- GuidConverter.cs
- AudioFileOut.cs
- XmlSchemaValidator.cs