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
- CookieParameter.cs
- ListenerElementsCollection.cs
- TargetParameterCountException.cs
- SqlDataRecord.cs
- Security.cs
- TextRangeBase.cs
- StructuralObject.cs
- ProtocolsConfiguration.cs
- SqlDataSourceView.cs
- XamlGridLengthSerializer.cs
- EnvironmentPermission.cs
- WorkflowPersistenceService.cs
- BaseParser.cs
- ResponseStream.cs
- ResXDataNode.cs
- TextEmbeddedObject.cs
- BinaryCommonClasses.cs
- FixedPosition.cs
- EntityViewGenerator.cs
- UntypedNullExpression.cs
- AssemblyBuilder.cs
- LockCookie.cs
- AudioFormatConverter.cs
- HealthMonitoringSection.cs
- ZipIOExtraFieldZip64Element.cs
- HtmlUtf8RawTextWriter.cs
- OpacityConverter.cs
- RemoveStoryboard.cs
- VirtualDirectoryMapping.cs
- XamlHostingSection.cs
- PolicyManager.cs
- DataGridTableStyleMappingNameEditor.cs
- XMLDiffLoader.cs
- baseaxisquery.cs
- HtmlTableRowCollection.cs
- TrackBarRenderer.cs
- EditingMode.cs
- ListBindingHelper.cs
- XmlQueryRuntime.cs
- WebPartManager.cs
- Brushes.cs
- OptionUsage.cs
- InternalConfigEventArgs.cs
- SelectionWordBreaker.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- QueryableDataSource.cs
- ObsoleteAttribute.cs
- DataSourceControl.cs
- ThreadPool.cs
- ISCIIEncoding.cs
- SqlBinder.cs
- TemplateParser.cs
- CommonObjectSecurity.cs
- TransportOutputChannel.cs
- CapabilitiesAssignment.cs
- DataGridViewDataConnection.cs
- SectionInput.cs
- DesignerForm.cs
- UrlMapping.cs
- DataGridViewTextBoxCell.cs
- NeutralResourcesLanguageAttribute.cs
- ContentOperations.cs
- FactoryGenerator.cs
- __Filters.cs
- XmlIlTypeHelper.cs
- ForeignConstraint.cs
- SqlRemoveConstantOrderBy.cs
- DataServiceConfiguration.cs
- HtmlSelect.cs
- GridItemProviderWrapper.cs
- CapabilitiesRule.cs
- DecoderExceptionFallback.cs
- EntryPointNotFoundException.cs
- ResourceWriter.cs
- XmlRawWriter.cs
- EDesignUtil.cs
- ProcessModuleCollection.cs
- ToolboxItemFilterAttribute.cs
- Expander.cs
- MexNamedPipeBindingElement.cs
- X509CertificateClaimSet.cs
- ApplicationFileParser.cs
- securitycriticaldataformultiplegetandset.cs
- ServiceHostFactory.cs
- SessionEndedEventArgs.cs
- NativeRecognizer.cs
- CompressedStack.cs
- RSACryptoServiceProvider.cs
- SafeRegistryKey.cs
- OleDbDataAdapter.cs
- KeyedPriorityQueue.cs
- DataBoundLiteralControl.cs
- MutexSecurity.cs
- WizardForm.cs
- ImageCodecInfo.cs
- DataGridViewCellParsingEventArgs.cs
- userdatakeys.cs
- WebPartConnectionsCancelVerb.cs
- UnionCodeGroup.cs
- ObjectTypeMapping.cs