Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- OutputCacheSection.cs
- DoubleAnimationUsingPath.cs
- XamlClipboardData.cs
- SyndicationSerializer.cs
- TreeNodeBindingCollection.cs
- ITreeGenerator.cs
- MetaModel.cs
- SHA1.cs
- NumberFunctions.cs
- TrustLevel.cs
- WebDisplayNameAttribute.cs
- PerformanceCounterPermission.cs
- Rect3D.cs
- PersonalizationStateInfoCollection.cs
- RegexMatch.cs
- VBIdentifierNameEditor.cs
- NumericExpr.cs
- DataGridViewRowsAddedEventArgs.cs
- TypeNameConverter.cs
- ConnectionInterfaceCollection.cs
- FastPropertyAccessor.cs
- InkCanvasInnerCanvas.cs
- MULTI_QI.cs
- SQLGuid.cs
- CriticalExceptions.cs
- AlignmentYValidation.cs
- SspiSecurityTokenParameters.cs
- EmptyQuery.cs
- StateMachineHelpers.cs
- SqlBuilder.cs
- AsymmetricSignatureDeformatter.cs
- TransactionScope.cs
- SQLMembershipProvider.cs
- DaylightTime.cs
- InfoCardKeyedHashAlgorithm.cs
- SmtpTransport.cs
- CryptoHandle.cs
- Message.cs
- CircleHotSpot.cs
- TransformGroup.cs
- ListViewItem.cs
- XamlFrame.cs
- AuthenticationServiceManager.cs
- VerificationAttribute.cs
- MsmqElementBase.cs
- ProjectionPruner.cs
- RectangleHotSpot.cs
- SecurityContext.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- filewebresponse.cs
- IOException.cs
- COM2IDispatchConverter.cs
- PageFunction.cs
- EdmSchemaAttribute.cs
- ThrowHelper.cs
- PriorityChain.cs
- ExpressionConverter.cs
- DesignerSerializationVisibilityAttribute.cs
- CriticalHandle.cs
- AssemblyCollection.cs
- XmlILAnnotation.cs
- HostingEnvironment.cs
- CompoundFileStorageReference.cs
- ValueConversionAttribute.cs
- ContextActivityUtils.cs
- StringCollection.cs
- ListViewTableRow.cs
- BamlResourceSerializer.cs
- MimeTextImporter.cs
- HtmlImage.cs
- PolygonHotSpot.cs
- ScaleTransform3D.cs
- DbConnectionHelper.cs
- TreeBuilderXamlTranslator.cs
- ParameterInfo.cs
- PropertyInformation.cs
- ProjectionPath.cs
- CompilationSection.cs
- RuntimeWrappedException.cs
- RegexCharClass.cs
- EdmScalarPropertyAttribute.cs
- SqlRecordBuffer.cs
- HandlerFactoryCache.cs
- CmsUtils.cs
- XmlFormatWriterGenerator.cs
- EventEntry.cs
- AlternationConverter.cs
- SqlAggregateChecker.cs
- RoleManagerModule.cs
- metadatamappinghashervisitor.cs
- MenuEventArgs.cs
- IntSecurity.cs
- DecimalFormatter.cs
- LogicalTreeHelper.cs
- ConnectionsZone.cs
- DesignerAttribute.cs
- GridViewRowPresenterBase.cs
- PointConverter.cs
- DataServiceHostFactory.cs
- ThemeDirectoryCompiler.cs