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
- XamlContextStack.cs
- HighlightVisual.cs
- AffineTransform3D.cs
- CheckBox.cs
- PropertyChangingEventArgs.cs
- XPathNavigator.cs
- XmlSchemaSimpleContentExtension.cs
- WindowsTokenRoleProvider.cs
- ImageFormatConverter.cs
- ComponentCommands.cs
- ColumnHeader.cs
- ManifestResourceInfo.cs
- Freezable.cs
- FixedSOMGroup.cs
- TraceSection.cs
- ArrayHelper.cs
- TextProperties.cs
- FontDifferentiator.cs
- LicenseManager.cs
- DropShadowEffect.cs
- UnsafeNativeMethods.cs
- DataSourceUtil.cs
- UndoManager.cs
- SqlSelectClauseBuilder.cs
- TrackBar.cs
- FileDialogPermission.cs
- SQLInt64.cs
- OracleEncoding.cs
- DashStyle.cs
- GPRECT.cs
- HtmlHead.cs
- ValueQuery.cs
- NameService.cs
- MonthChangedEventArgs.cs
- PerformanceCounters.cs
- LockedActivityGlyph.cs
- ElementNotAvailableException.cs
- WpfXamlLoader.cs
- VectorCollection.cs
- TreeBuilderBamlTranslator.cs
- TraceContextEventArgs.cs
- LinkDescriptor.cs
- ReflectionTypeLoadException.cs
- SafeCertificateStore.cs
- CustomErrorCollection.cs
- COM2PropertyDescriptor.cs
- FileFormatException.cs
- ScrollProperties.cs
- HeaderCollection.cs
- MemberInfoSerializationHolder.cs
- LineMetrics.cs
- TextBoxLine.cs
- ToolStripContainer.cs
- MetadataItemEmitter.cs
- WindowsFormsHostAutomationPeer.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- DataRecordObjectView.cs
- UnionQueryOperator.cs
- ContentPlaceHolder.cs
- WebBrowserEvent.cs
- XmlSchemaSet.cs
- HandoffBehavior.cs
- ITextView.cs
- JsonFormatGeneratorStatics.cs
- DropDownList.cs
- SystemUdpStatistics.cs
- DockProviderWrapper.cs
- HttpHandlerActionCollection.cs
- Stylus.cs
- ColorContextHelper.cs
- ValueChangedEventManager.cs
- FileDialogCustomPlace.cs
- ControlIdConverter.cs
- CommandID.cs
- PersistencePipeline.cs
- Mouse.cs
- Delegate.cs
- IntPtr.cs
- DesignOnlyAttribute.cs
- ToggleButtonAutomationPeer.cs
- WebPartTransformerAttribute.cs
- UnsettableComboBox.cs
- DocumentGrid.cs
- ProfilePropertySettings.cs
- WebBrowserNavigatingEventHandler.cs
- util.cs
- DataGridPreparingCellForEditEventArgs.cs
- IncrementalReadDecoders.cs
- DateTimePicker.cs
- ListViewUpdateEventArgs.cs
- DataGridViewComboBoxEditingControl.cs
- PathSegmentCollection.cs
- StringWriter.cs
- NavigateEvent.cs
- CompilerInfo.cs
- ApplicationSecurityInfo.cs
- Privilege.cs
- XXXOnTypeBuilderInstantiation.cs
- ParameterBuilder.cs
- RoutingExtensionElement.cs