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
- RelOps.cs
- DiscreteKeyFrames.cs
- PageAsyncTaskManager.cs
- ConfigXmlCDataSection.cs
- UIElement3D.cs
- XmlElementAttribute.cs
- CertificateManager.cs
- altserialization.cs
- WebPartAuthorizationEventArgs.cs
- ListViewDataItem.cs
- DataShape.cs
- CollectionBuilder.cs
- GridViewColumnHeader.cs
- AjaxFrameworkAssemblyAttribute.cs
- MsmqTransportElement.cs
- BackgroundFormatInfo.cs
- TabItemAutomationPeer.cs
- SizeF.cs
- ValueTable.cs
- DefaultValueAttribute.cs
- ArgumentsParser.cs
- ResourcesBuildProvider.cs
- ChineseLunisolarCalendar.cs
- EnumValidator.cs
- CommonRemoteMemoryBlock.cs
- TraversalRequest.cs
- NativeCppClassAttribute.cs
- Section.cs
- WorkflowViewManager.cs
- ToolboxItemSnapLineBehavior.cs
- ILGen.cs
- GridViewSelectEventArgs.cs
- RequestSecurityToken.cs
- SoapHelper.cs
- InstancePersistenceEvent.cs
- SafeLibraryHandle.cs
- _TLSstream.cs
- Int32CollectionValueSerializer.cs
- StorageModelBuildProvider.cs
- WebControl.cs
- DoubleAnimationClockResource.cs
- AssemblyInfo.cs
- MediaTimeline.cs
- RadioButtonList.cs
- RegexWorker.cs
- DesignSurface.cs
- CustomSignedXml.cs
- WebAdminConfigurationHelper.cs
- TextBounds.cs
- TailCallAnalyzer.cs
- SubtreeProcessor.cs
- EntityDataSourceContextCreatingEventArgs.cs
- TemplateKeyConverter.cs
- WebPartDescriptionCollection.cs
- ConnectionProviderAttribute.cs
- CodeNamespaceImportCollection.cs
- SmiRequestExecutor.cs
- XmlCharCheckingReader.cs
- LinearKeyFrames.cs
- ShaderRenderModeValidation.cs
- TextEditorSelection.cs
- DataMisalignedException.cs
- OleStrCAMarshaler.cs
- StringResourceManager.cs
- ListViewGroupConverter.cs
- ToolboxItemAttribute.cs
- Root.cs
- FontDriver.cs
- ServiceOperation.cs
- RemoteWebConfigurationHostStream.cs
- AssemblyBuilderData.cs
- LambdaCompiler.Lambda.cs
- DataGridViewRowCancelEventArgs.cs
- BypassElementCollection.cs
- DataGridViewDataErrorEventArgs.cs
- WebHeaderCollection.cs
- HwndSourceKeyboardInputSite.cs
- DaylightTime.cs
- Funcletizer.cs
- IncrementalReadDecoders.cs
- HorizontalAlignConverter.cs
- BitmapEffectGeneralTransform.cs
- HelpEvent.cs
- SettingsPropertyCollection.cs
- IndexerNameAttribute.cs
- SqlDataSourceStatusEventArgs.cs
- TextSegment.cs
- DiagnosticsConfiguration.cs
- VisualStateManager.cs
- AlphaSortedEnumConverter.cs
- FixedSOMTable.cs
- BlobPersonalizationState.cs
- ZipIOCentralDirectoryDigitalSignature.cs
- EventManager.cs
- SafeEventLogReadHandle.cs
- MulticastIPAddressInformationCollection.cs
- PointF.cs
- Int64Converter.cs
- MachineKeySection.cs
- WinEventQueueItem.cs