Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- DbDataRecord.cs
- SqlDuplicator.cs
- ValueUtilsSmi.cs
- RecognizeCompletedEventArgs.cs
- MimeFormatter.cs
- FontWeights.cs
- SQLInt16Storage.cs
- Tile.cs
- Transform3D.cs
- PerfCounters.cs
- ListViewHitTestInfo.cs
- precedingsibling.cs
- HttpException.cs
- CacheVirtualItemsEvent.cs
- HttpMethodAttribute.cs
- MasterPageBuildProvider.cs
- Certificate.cs
- MetadataUtil.cs
- MarkupCompiler.cs
- invalidudtexception.cs
- RepeatBehavior.cs
- WebPartConnectionsConnectVerb.cs
- DynamicValueConverter.cs
- CodeTypeParameterCollection.cs
- _SslSessionsCache.cs
- Grid.cs
- cookiecontainer.cs
- PtsHelper.cs
- AssemblyHelper.cs
- StrongName.cs
- RadioButtonStandardAdapter.cs
- DataColumnCollection.cs
- PasswordRecoveryAutoFormat.cs
- QilVisitor.cs
- FlowDocumentFormatter.cs
- RegisteredArrayDeclaration.cs
- XmlReader.cs
- BufferBuilder.cs
- XmlSchemaGroupRef.cs
- FrameworkContentElement.cs
- Visual3D.cs
- XsdCachingReader.cs
- AppDomainManager.cs
- KnownBoxes.cs
- NameSpaceExtractor.cs
- EntityDataSourceStatementEditor.cs
- AstNode.cs
- IDReferencePropertyAttribute.cs
- ValueExpressions.cs
- TextContainerChangeEventArgs.cs
- SafeMILHandle.cs
- SizeAnimationClockResource.cs
- SoapReflectionImporter.cs
- CmsInterop.cs
- httpapplicationstate.cs
- IsolatedStorageException.cs
- DBConnection.cs
- AttributeCollection.cs
- ArgumentDesigner.xaml.cs
- ConfigsHelper.cs
- AssemblyName.cs
- SafeArchiveContext.cs
- WebPartMovingEventArgs.cs
- DocumentApplication.cs
- SettingsSection.cs
- ThousandthOfEmRealPoints.cs
- MessagePropertyAttribute.cs
- DataGridState.cs
- ResourceReferenceExpressionConverter.cs
- PropertyPathWorker.cs
- DropTarget.cs
- RelationshipConverter.cs
- LoginDesignerUtil.cs
- _SslSessionsCache.cs
- JobPageOrder.cs
- LogLogRecord.cs
- GeometryHitTestParameters.cs
- BypassElementCollection.cs
- XmlObjectSerializerReadContextComplex.cs
- HttpPostedFile.cs
- ColorMap.cs
- SimpleType.cs
- XmlSchemaSimpleType.cs
- ISAPIWorkerRequest.cs
- Int32Storage.cs
- PopupControlService.cs
- UrlPath.cs
- PublisherMembershipCondition.cs
- ColumnCollection.cs
- ValidateNames.cs
- XmlIncludeAttribute.cs
- RenderData.cs
- Trace.cs
- DocumentPropertiesDialog.cs
- BitSet.cs
- Nullable.cs
- TextDecorationLocationValidation.cs
- DoubleStorage.cs
- TreeIterator.cs
- MarkupCompiler.cs