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
- TypeSemantics.cs
- ClientRolePrincipal.cs
- TransactionFlowBindingElement.cs
- _StreamFramer.cs
- CheckPair.cs
- ResizeGrip.cs
- FixedSOMGroup.cs
- RTLAwareMessageBox.cs
- XmlDocumentType.cs
- Identity.cs
- ZipIORawDataFileBlock.cs
- TransformationRules.cs
- ReturnType.cs
- TypedReference.cs
- DotNetATv1WindowsLogEntryDeserializer.cs
- XomlCompilerResults.cs
- Column.cs
- WmpBitmapEncoder.cs
- BaseDataList.cs
- ExpressionPrefixAttribute.cs
- TypeContext.cs
- Expression.cs
- SessionStateContainer.cs
- FrameworkContentElement.cs
- DataSourceView.cs
- NotCondition.cs
- StandardCommands.cs
- DataGridViewSelectedCellCollection.cs
- DrawingGroup.cs
- CollectionContainer.cs
- TickBar.cs
- ControlBindingsCollection.cs
- ToolStripStatusLabel.cs
- BindableAttribute.cs
- TableLayoutSettingsTypeConverter.cs
- ModelTreeManager.cs
- Point4D.cs
- UnsafeNativeMethods.cs
- SafeLocalAllocation.cs
- X509CertificateValidator.cs
- SecurityAlgorithmSuite.cs
- HttpGetServerProtocol.cs
- CollectionsUtil.cs
- XamlReaderConstants.cs
- NumericUpDownAcceleration.cs
- FileLogRecord.cs
- PaginationProgressEventArgs.cs
- DataGridView.cs
- AsyncResult.cs
- BindingCompleteEventArgs.cs
- ListBoxItemWrapperAutomationPeer.cs
- ScriptingScriptResourceHandlerSection.cs
- HtmlTextBoxAdapter.cs
- WebPart.cs
- PrivateFontCollection.cs
- DeclarativeCatalogPartDesigner.cs
- Typography.cs
- XmlDocumentSerializer.cs
- MessagePropertyFilter.cs
- TemplateControlBuildProvider.cs
- DataGridViewSelectedRowCollection.cs
- TextRangeEditLists.cs
- BinaryKeyIdentifierClause.cs
- Geometry3D.cs
- TimersDescriptionAttribute.cs
- HierarchicalDataTemplate.cs
- SymDocumentType.cs
- RankException.cs
- HeaderCollection.cs
- ApplicationFileParser.cs
- DispatchChannelSink.cs
- EventHandlersStore.cs
- BrowserTree.cs
- GridProviderWrapper.cs
- MimeTextImporter.cs
- XsdDateTime.cs
- EntitySetDataBindingList.cs
- CodeEventReferenceExpression.cs
- SerializableAttribute.cs
- XmlResolver.cs
- ActivationProxy.cs
- AssemblyUtil.cs
- StickyNoteHelper.cs
- CellRelation.cs
- Form.cs
- DeviceSpecificDialogCachedState.cs
- RotationValidation.cs
- entityreference_tresulttype.cs
- FunctionImportMapping.cs
- SystemDropShadowChrome.cs
- ErrorHandlerFaultInfo.cs
- PackageStore.cs
- JsonWriter.cs
- StyleCollectionEditor.cs
- PrintEvent.cs
- BitmapMetadata.cs
- LabelTarget.cs
- UnsafeNativeMethods.cs
- GeometryValueSerializer.cs
- List.cs