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
- SQLInt32Storage.cs
- LongMinMaxAggregationOperator.cs
- StickyNoteHelper.cs
- AgileSafeNativeMemoryHandle.cs
- NumberFormatter.cs
- HwndSubclass.cs
- FileChangesMonitor.cs
- ScriptBehaviorDescriptor.cs
- WebPartsPersonalization.cs
- TimeSpanOrInfiniteConverter.cs
- Assert.cs
- DataSourceXmlSerializer.cs
- DashStyle.cs
- PhonemeEventArgs.cs
- Panel.cs
- FunctionNode.cs
- WorkflowCompensationBehavior.cs
- Ipv6Element.cs
- DependencyObjectPropertyDescriptor.cs
- WindowsStartMenu.cs
- BitmapEffectGroup.cs
- cookiecollection.cs
- InternalsVisibleToAttribute.cs
- MethodToken.cs
- MethodExecutor.cs
- FilePrompt.cs
- StandardToolWindows.cs
- CreateRefExpr.cs
- CodeDomSerializerBase.cs
- CryptoConfig.cs
- SerializerWriterEventHandlers.cs
- FrameworkTemplate.cs
- ApplicationManager.cs
- MethodInfo.cs
- Utils.cs
- SqlUdtInfo.cs
- DetailsViewDeletedEventArgs.cs
- SymmetricAlgorithm.cs
- XPathDocument.cs
- ValueType.cs
- ThicknessAnimation.cs
- SqlDeflator.cs
- SvcMapFileSerializer.cs
- DeobfuscatingStream.cs
- ApplicationInfo.cs
- HwndProxyElementProvider.cs
- MetadataPropertyCollection.cs
- InstancePersistenceCommandException.cs
- TemplateBindingExpressionConverter.cs
- TextFormatterImp.cs
- InlineCollection.cs
- Visual3DCollection.cs
- ResolveNameEventArgs.cs
- RsaSecurityToken.cs
- LinkLabelLinkClickedEvent.cs
- TextFindEngine.cs
- HeaderUtility.cs
- SettingsAttributeDictionary.cs
- ArrayElementGridEntry.cs
- DebugController.cs
- UserControl.cs
- ResourcePool.cs
- DelegateTypeInfo.cs
- ToolStripAdornerWindowService.cs
- SubpageParagraph.cs
- ControlValuePropertyAttribute.cs
- BooleanStorage.cs
- SchemaImporterExtensionElementCollection.cs
- XPathMultyIterator.cs
- SchemaHelper.cs
- SQLBinaryStorage.cs
- PathStreamGeometryContext.cs
- HttpConfigurationSystem.cs
- KeyValueInternalCollection.cs
- Int32Rect.cs
- TextMarkerSource.cs
- webeventbuffer.cs
- BooleanAnimationUsingKeyFrames.cs
- MulticastOption.cs
- AdapterDictionary.cs
- AutoGeneratedField.cs
- ExtensionQuery.cs
- DataStreamFromComStream.cs
- GAC.cs
- CommunicationObjectFaultedException.cs
- EarlyBoundInfo.cs
- NullReferenceException.cs
- ResourceExpressionBuilder.cs
- OutputCacheModule.cs
- FormatterServices.cs
- ColorPalette.cs
- CrossAppDomainChannel.cs
- DrawListViewColumnHeaderEventArgs.cs
- RemoveFromCollection.cs
- RepeatInfo.cs
- UnsafeNativeMethods.cs
- RawStylusSystemGestureInputReport.cs
- SystemIcmpV6Statistics.cs
- FixedTextBuilder.cs
- CodeTypeDelegate.cs