Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / ComponentModel / COM2Interop / OleStrCAMarshaler.cs / 1305376 / 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
- ListViewTableRow.cs
- IListConverters.cs
- DataTemplateKey.cs
- UpdateManifestForBrowserApplication.cs
- MultiPageTextView.cs
- ChameleonKey.cs
- Trace.cs
- WebPartManagerInternals.cs
- Localizer.cs
- SettingsBindableAttribute.cs
- BookmarkCallbackWrapper.cs
- GlyphRun.cs
- ValueSerializerAttribute.cs
- DecodeHelper.cs
- BamlRecordReader.cs
- PerspectiveCamera.cs
- ZipIOCentralDirectoryBlock.cs
- NameValueConfigurationCollection.cs
- WebWorkflowRole.cs
- FixedDSBuilder.cs
- AnnotationComponentChooser.cs
- StylusPlugin.cs
- FixedHighlight.cs
- FormatStringEditor.cs
- RuleSettingsCollection.cs
- GifBitmapDecoder.cs
- DataListItem.cs
- ProcessInputEventArgs.cs
- DataObjectCopyingEventArgs.cs
- RefreshEventArgs.cs
- CounterCreationDataCollection.cs
- IPEndPoint.cs
- InnerItemCollectionView.cs
- ConnectionInterfaceCollection.cs
- DefaultSettingsSection.cs
- GlobalProxySelection.cs
- HtmlInputButton.cs
- ToolboxComponentsCreatedEventArgs.cs
- DropShadowBitmapEffect.cs
- DispatcherHookEventArgs.cs
- DataServiceRequestOfT.cs
- SecUtil.cs
- ThaiBuddhistCalendar.cs
- WebPartActionVerb.cs
- XmlElementAttributes.cs
- BuilderPropertyEntry.cs
- XamlStyleSerializer.cs
- UIPropertyMetadata.cs
- EdgeModeValidation.cs
- AdornerPresentationContext.cs
- Roles.cs
- Constants.cs
- SqlDeflator.cs
- FlowDocumentPageViewerAutomationPeer.cs
- DataBoundLiteralControl.cs
- PageSetupDialog.cs
- OptimalBreakSession.cs
- Int64Converter.cs
- WpfXamlType.cs
- ImageButton.cs
- CompiledAction.cs
- XmlExpressionDumper.cs
- MarkupCompiler.cs
- MenuEventArgs.cs
- HttpVersion.cs
- FrameworkReadOnlyPropertyMetadata.cs
- UpdateRecord.cs
- RtfToken.cs
- MainMenu.cs
- PropertyChangedEventArgs.cs
- GridViewRowPresenter.cs
- StorageEntityTypeMapping.cs
- InputDevice.cs
- Win32.cs
- SerializationFieldInfo.cs
- DoubleCollectionConverter.cs
- LinkedResourceCollection.cs
- TextRangeSerialization.cs
- GeneralTransform3DTo2DTo3D.cs
- IndentedWriter.cs
- ObjectListCommandsPage.cs
- ConfigurationManagerInternal.cs
- InstanceCreationEditor.cs
- Link.cs
- SiteMapProvider.cs
- WinEventQueueItem.cs
- SqlCacheDependency.cs
- EditorZoneBase.cs
- HttpServerUtilityWrapper.cs
- UrlMappingsSection.cs
- ObjectPropertyMapping.cs
- BypassElement.cs
- AQNBuilder.cs
- LineSegment.cs
- SaveFileDialog.cs
- SQLDouble.cs
- ModelUIElement3D.cs
- WorkflowDebuggerSteppingAttribute.cs
- DbConvert.cs
- CodePrimitiveExpression.cs