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
- XmlChoiceIdentifierAttribute.cs
- AnnotationComponentChooser.cs
- TransactionTraceIdentifier.cs
- Classification.cs
- HtmlInputCheckBox.cs
- SimpleApplicationHost.cs
- PropertyChangedEventArgs.cs
- XappLauncher.cs
- UIElement.cs
- Storyboard.cs
- UnlockInstanceAsyncResult.cs
- WebPartZoneAutoFormat.cs
- UseLicense.cs
- TextEditorParagraphs.cs
- WindowsFont.cs
- ApplicationGesture.cs
- PrimitiveXmlSerializers.cs
- PictureBoxDesigner.cs
- DataTableClearEvent.cs
- ConvertersCollection.cs
- BamlBinaryReader.cs
- DataFormat.cs
- RichTextBoxAutomationPeer.cs
- IndentedTextWriter.cs
- IsolatedStoragePermission.cs
- SamlEvidence.cs
- ShaderEffect.cs
- MarkupObject.cs
- SchemaImporter.cs
- NamedPipeTransportElement.cs
- SystemInfo.cs
- PageSettings.cs
- SearchForVirtualItemEventArgs.cs
- ToolStripDropDownMenu.cs
- CollectionViewSource.cs
- SecureEnvironment.cs
- BroadcastEventHelper.cs
- TypeSchema.cs
- HttpWebRequestElement.cs
- InstallHelper.cs
- SecurityToken.cs
- OneOfScalarConst.cs
- WebBrowserContainer.cs
- ResourcePool.cs
- hresults.cs
- MissingMethodException.cs
- XPathPatternBuilder.cs
- JoinGraph.cs
- _FixedSizeReader.cs
- TemplatePropertyEntry.cs
- LinearQuaternionKeyFrame.cs
- ServiceContractViewControl.Designer.cs
- ReaderWriterLock.cs
- ServiceCredentials.cs
- Operand.cs
- KeyProperty.cs
- GeometryModel3D.cs
- ConcurrentQueue.cs
- ToolStripDesignerAvailabilityAttribute.cs
- NativeMethods.cs
- Simplifier.cs
- MetadataArtifactLoaderCompositeFile.cs
- WindowsFont.cs
- MasterPageParser.cs
- AccessDataSourceView.cs
- TemplateControlBuildProvider.cs
- List.cs
- ObjectSecurity.cs
- CodeTypeConstructor.cs
- DBConnectionString.cs
- DirectoryRootQuery.cs
- StyleXamlParser.cs
- ColorTypeConverter.cs
- PropertyHelper.cs
- securitycriticaldata.cs
- HttpWrapper.cs
- XmlAnyElementAttributes.cs
- XmlNodeList.cs
- ConnectionOrientedTransportChannelListener.cs
- AttachedPropertyMethodSelector.cs
- RichTextBoxAutomationPeer.cs
- Material.cs
- XmlSchemaAnyAttribute.cs
- WebEventTraceProvider.cs
- DynamicMethod.cs
- ConstraintEnumerator.cs
- HeaderedItemsControl.cs
- HtmlImageAdapter.cs
- Row.cs
- Queue.cs
- PackWebResponse.cs
- WebBrowser.cs
- Action.cs
- MeshGeometry3D.cs
- UnknownWrapper.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- IndentTextWriter.cs
- HttpHandlerAction.cs
- SpecularMaterial.cs
- x509utils.cs