Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- AttributedMetaModel.cs
- IndependentlyAnimatedPropertyMetadata.cs
- WorkflowApplicationAbortedException.cs
- XmlConvert.cs
- ThousandthOfEmRealPoints.cs
- AnimationClockResource.cs
- DebugHandleTracker.cs
- EntityException.cs
- ImageBrush.cs
- PassportPrincipal.cs
- CircleEase.cs
- LambdaCompiler.Expressions.cs
- TextRangeBase.cs
- MatrixAnimationBase.cs
- DataGridViewRowPostPaintEventArgs.cs
- FormView.cs
- SequenceRangeCollection.cs
- SecurityKeyIdentifier.cs
- PrivacyNoticeBindingElementImporter.cs
- ImageSource.cs
- SoapAttributeOverrides.cs
- PageThemeCodeDomTreeGenerator.cs
- ExternalException.cs
- DataControlFieldTypeEditor.cs
- PageHandlerFactory.cs
- OleDbConnection.cs
- QuotedPairReader.cs
- EntityType.cs
- ModelFactory.cs
- FontFamilyIdentifier.cs
- xmlformatgeneratorstatics.cs
- webeventbuffer.cs
- SqlUserDefinedAggregateAttribute.cs
- AssemblyCache.cs
- DbConnectionOptions.cs
- DataRelation.cs
- AtomMaterializerLog.cs
- AnnotationElement.cs
- DateRangeEvent.cs
- EventRoute.cs
- PatternMatcher.cs
- EvidenceBase.cs
- SortDescription.cs
- MembershipSection.cs
- DataTableNameHandler.cs
- OdbcEnvironment.cs
- Mapping.cs
- StorageConditionPropertyMapping.cs
- UTF32Encoding.cs
- WebControl.cs
- WorkflowTimerService.cs
- Size.cs
- WebPartMovingEventArgs.cs
- DataTableMapping.cs
- TextPattern.cs
- PrimitiveType.cs
- ListItemsCollectionEditor.cs
- _UncName.cs
- ToolStripSeparator.cs
- ScriptBehaviorDescriptor.cs
- ToolStripPanelSelectionGlyph.cs
- XmlUtil.cs
- WorkItem.cs
- HttpRequest.cs
- BufferedGraphicsManager.cs
- WebHttpDispatchOperationSelectorData.cs
- CodeGroup.cs
- PowerEase.cs
- SQLString.cs
- MultiSelector.cs
- SR.cs
- TextBox.cs
- BypassElement.cs
- RegexMatchCollection.cs
- ResourceReferenceExpressionConverter.cs
- BamlVersionHeader.cs
- _Connection.cs
- FormClosedEvent.cs
- ScrollEventArgs.cs
- Graph.cs
- PageHandlerFactory.cs
- EmbeddedMailObject.cs
- MemberNameValidator.cs
- DependentList.cs
- NativeMethods.cs
- SizeValueSerializer.cs
- PropertyValueChangedEvent.cs
- DescriptionAttribute.cs
- Rijndael.cs
- HttpApplication.cs
- BatchParser.cs
- XmlSchemaAny.cs
- FormatException.cs
- ImageUrlEditor.cs
- ObservableDictionary.cs
- DoubleLinkList.cs
- StandardTransformFactory.cs
- StateBag.cs
- ErrorWrapper.cs
- ExtensionMethods.cs