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
- TypeSource.cs
- DataGridViewButtonCell.cs
- MarshalDirectiveException.cs
- SafeLibraryHandle.cs
- DesignerTransaction.cs
- AxisAngleRotation3D.cs
- BmpBitmapDecoder.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- XslTransformFileEditor.cs
- CreateRefExpr.cs
- XmlDocumentSerializer.cs
- ConnectionAcceptor.cs
- CompressionTransform.cs
- SafeBitVector32.cs
- ImageFormat.cs
- ScriptingRoleServiceSection.cs
- ControlAdapter.cs
- InkCanvas.cs
- XmlSchemaAppInfo.cs
- ProcessModelInfo.cs
- IconConverter.cs
- Pair.cs
- PackageRelationshipSelector.cs
- SoapEnumAttribute.cs
- OracleCommand.cs
- WebBrowsableAttribute.cs
- XmlHelper.cs
- Vector3DCollectionConverter.cs
- Drawing.cs
- ImageButton.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ColorMap.cs
- TextModifierScope.cs
- DefaultShape.cs
- ViewDesigner.cs
- Update.cs
- CodeDelegateInvokeExpression.cs
- LayoutEvent.cs
- Item.cs
- DesignerLoader.cs
- ConfigurationStrings.cs
- SafeNativeMethods.cs
- EmptyCollection.cs
- SecurityState.cs
- DependencyPropertyDescriptor.cs
- BitmapCodecInfo.cs
- HtmlTitle.cs
- Section.cs
- OrderedDictionaryStateHelper.cs
- SerializationObjectManager.cs
- Update.cs
- MarginCollapsingState.cs
- odbcmetadatacollectionnames.cs
- SystemPens.cs
- XmlDocumentFragment.cs
- ControlParser.cs
- PngBitmapEncoder.cs
- EdmEntityTypeAttribute.cs
- HttpCapabilitiesEvaluator.cs
- XmlNodeChangedEventManager.cs
- Query.cs
- DataServiceExpressionVisitor.cs
- Expression.cs
- uribuilder.cs
- CustomTypeDescriptor.cs
- OciHandle.cs
- WebConvert.cs
- OutputBuffer.cs
- RegexRunner.cs
- SoapExtensionReflector.cs
- ViewPort3D.cs
- XmlChoiceIdentifierAttribute.cs
- X509DefaultServiceCertificateElement.cs
- ImageDrawing.cs
- UIAgentCrashedException.cs
- OdbcDataAdapter.cs
- StringConcat.cs
- EnumDataContract.cs
- SQLGuidStorage.cs
- DiscoveryDocumentSerializer.cs
- ProxyGenerator.cs
- XmlSchemaSimpleType.cs
- Pointer.cs
- DataSetViewSchema.cs
- KnownIds.cs
- DesignerForm.cs
- COAUTHIDENTITY.cs
- TargetControlTypeCache.cs
- RSAPKCS1KeyExchangeFormatter.cs
- SamlAuthorizationDecisionClaimResource.cs
- HostedHttpContext.cs
- MemberBinding.cs
- AuthorizationRuleCollection.cs
- CodeSubDirectoriesCollection.cs
- HttpModuleActionCollection.cs
- TemplateKey.cs
- SuppressMergeCheckAttribute.cs
- PropertyState.cs
- ByteViewer.cs
- BinaryObjectInfo.cs