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
- x509store.cs
- UrlParameterWriter.cs
- InputLanguageProfileNotifySink.cs
- SqlDataSourceCommandEventArgs.cs
- DataControlFieldTypeEditor.cs
- CategoryAttribute.cs
- Constraint.cs
- UnsafeNetInfoNativeMethods.cs
- InArgumentConverter.cs
- XamlRtfConverter.cs
- XamlNamespaceHelper.cs
- GlobalizationSection.cs
- DoubleMinMaxAggregationOperator.cs
- XsdValidatingReader.cs
- Renderer.cs
- UnSafeCharBuffer.cs
- versioninfo.cs
- _AcceptOverlappedAsyncResult.cs
- DataFormats.cs
- ItemCollectionEditor.cs
- ExpressionBuilderContext.cs
- ToolBarTray.cs
- RuntimeVariableList.cs
- FixUp.cs
- ProfileManager.cs
- TypeExtensionSerializer.cs
- RectAnimationUsingKeyFrames.cs
- StaticTextPointer.cs
- ArrayListCollectionBase.cs
- RadioButtonPopupAdapter.cs
- FieldBuilder.cs
- TableLayoutPanelCellPosition.cs
- ExeContext.cs
- ImplicitInputBrush.cs
- SchemaAttDef.cs
- XhtmlTextWriter.cs
- IsolatedStorageFilePermission.cs
- StaticTextPointer.cs
- OracleString.cs
- AnnotationResourceCollection.cs
- FormViewPagerRow.cs
- XPathNode.cs
- DateTime.cs
- PageStatePersister.cs
- SqlFormatter.cs
- CacheDependency.cs
- WindowsFont.cs
- DebugHandleTracker.cs
- ManagedWndProcTracker.cs
- DbConnectionPool.cs
- Columns.cs
- ColumnMapProcessor.cs
- FunctionImportElement.cs
- GeneratedContractType.cs
- TabControlAutomationPeer.cs
- DecodeHelper.cs
- X509CertificateValidator.cs
- ContractHandle.cs
- IPEndPointCollection.cs
- FlowDocumentPaginator.cs
- COM2PictureConverter.cs
- PreviewControlDesigner.cs
- SettingsPropertyIsReadOnlyException.cs
- DesignColumn.cs
- XmlExtensionFunction.cs
- WorkflowDefinitionDispenser.cs
- XmlDataFileEditor.cs
- ScrollBar.cs
- ConfigXmlCDataSection.cs
- ArglessEventHandlerProxy.cs
- ObjectDataSourceDisposingEventArgs.cs
- Ref.cs
- SamlAdvice.cs
- PixelFormatConverter.cs
- StaticContext.cs
- XmlTextReaderImpl.cs
- HWStack.cs
- RegexCode.cs
- httpstaticobjectscollection.cs
- LinkButton.cs
- BoolExpr.cs
- DataGridViewCell.cs
- Identity.cs
- OneToOneMappingSerializer.cs
- PcmConverter.cs
- DocumentPageView.cs
- HttpProtocolImporter.cs
- ToolStripDropDownClosingEventArgs.cs
- TagPrefixInfo.cs
- DiscoveryClientRequestChannel.cs
- TypeUtil.cs
- FormViewModeEventArgs.cs
- PagePropertiesChangingEventArgs.cs
- DataObjectEventArgs.cs
- ExternalException.cs
- WorkflowRuntimeServiceElement.cs
- RoutedEventConverter.cs
- ZipIOFileItemStream.cs
- Signature.cs
- WorkflowDebuggerSteppingAttribute.cs