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
- FormViewCommandEventArgs.cs
- SmiContext.cs
- XmlILStorageConverter.cs
- XmlSchemaComplexType.cs
- Image.cs
- DrawListViewItemEventArgs.cs
- DayRenderEvent.cs
- ForceCopyBuildProvider.cs
- DetailsViewRow.cs
- QueueProcessor.cs
- ServiceChannel.cs
- HandlerWithFactory.cs
- SystemUnicastIPAddressInformation.cs
- PropertyChangedEventManager.cs
- CallContext.cs
- StringArrayEditor.cs
- MarkerProperties.cs
- FloaterParagraph.cs
- KeyTimeConverter.cs
- DebugController.cs
- ColumnTypeConverter.cs
- EventBuilder.cs
- Point.cs
- sitestring.cs
- GroupBoxRenderer.cs
- PeerNameRecord.cs
- ProcessModelSection.cs
- StandardToolWindows.cs
- WindowsFormsHelpers.cs
- CompoundFileStorageReference.cs
- BitmapCodecInfoInternal.cs
- BaseCollection.cs
- EntityCommand.cs
- DesignConnectionCollection.cs
- SmtpException.cs
- Crc32Helper.cs
- SynchronizationContext.cs
- DrawingImage.cs
- TrackingWorkflowEventArgs.cs
- DirtyTextRange.cs
- Version.cs
- Int32RectValueSerializer.cs
- OdbcRowUpdatingEvent.cs
- Int64KeyFrameCollection.cs
- DeferredTextReference.cs
- ContextItem.cs
- BitmapEffectInputConnector.cs
- GeneralTransformGroup.cs
- BooleanAnimationBase.cs
- RegexStringValidator.cs
- RecordConverter.cs
- XPathSelfQuery.cs
- DropShadowBitmapEffect.cs
- ReadOnlyCollectionBase.cs
- FixedSOMLineCollection.cs
- DataGridViewTopRowAccessibleObject.cs
- ApplicationId.cs
- Variable.cs
- ProviderCollection.cs
- SQLRoleProvider.cs
- Pair.cs
- AmbientProperties.cs
- WorkflowOwnershipException.cs
- AppDomain.cs
- FontResourceCache.cs
- ProcessingInstructionAction.cs
- DataFormats.cs
- Internal.cs
- WindowsStartMenu.cs
- AssemblyInfo.cs
- SuppressIldasmAttribute.cs
- Instrumentation.cs
- ChameleonKey.cs
- ProcessHost.cs
- SoapAttributeAttribute.cs
- CharUnicodeInfo.cs
- NumberFunctions.cs
- ComponentEditorPage.cs
- OdbcStatementHandle.cs
- FocusTracker.cs
- ActivityCodeGenerator.cs
- StructuredType.cs
- InvokeWebService.cs
- TypeSystem.cs
- AccessDataSource.cs
- DrawingAttributeSerializer.cs
- EditorZone.cs
- ReadOnlyAttribute.cs
- SequentialActivityDesigner.cs
- Rotation3DAnimationBase.cs
- DecimalConstantAttribute.cs
- UInt32Storage.cs
- CellParaClient.cs
- XsdDuration.cs
- QueryInterceptorAttribute.cs
- DataGridState.cs
- ModuleElement.cs
- EventWaitHandle.cs
- ShutDownListener.cs
- TabControl.cs