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
- PropertySourceInfo.cs
- SqlDataSourceFilteringEventArgs.cs
- ScriptReferenceBase.cs
- BindStream.cs
- OpCopier.cs
- processwaithandle.cs
- UnionCodeGroup.cs
- ErrorHandler.cs
- ReadOnlyPropertyMetadata.cs
- TrackingParticipant.cs
- ModuleElement.cs
- BulletedListDesigner.cs
- TaskResultSetter.cs
- XmlComplianceUtil.cs
- ExpressionLexer.cs
- CompiledELinqQueryState.cs
- MultiTrigger.cs
- RemoteX509Token.cs
- AllMembershipCondition.cs
- FunctionDefinition.cs
- IndexedGlyphRun.cs
- HtmlEmptyTagControlBuilder.cs
- HttpDebugHandler.cs
- ObjectConverter.cs
- DbXmlEnabledProviderManifest.cs
- TdsParserStateObject.cs
- WebPartAddingEventArgs.cs
- RijndaelCryptoServiceProvider.cs
- VoiceSynthesis.cs
- NetCodeGroup.cs
- MenuItemStyleCollection.cs
- XmlSchemaAny.cs
- XmlSchemaValidator.cs
- HostProtectionPermission.cs
- UnsafeNativeMethods.cs
- Select.cs
- Rotation3D.cs
- SqlStatistics.cs
- HtmlInputReset.cs
- WindowsTreeView.cs
- ColumnMapVisitor.cs
- TypeBuilderInstantiation.cs
- ToolZone.cs
- CircleHotSpot.cs
- ScrollData.cs
- EtwTrace.cs
- EntityStoreSchemaFilterEntry.cs
- RijndaelManaged.cs
- BitmapFrameEncode.cs
- Int32AnimationBase.cs
- _NetworkingPerfCounters.cs
- SqlCachedBuffer.cs
- LinqDataSourceView.cs
- _CookieModule.cs
- MappingSource.cs
- ConstantExpression.cs
- ProcessRequestArgs.cs
- DataProtectionSecurityStateEncoder.cs
- CharacterBuffer.cs
- TextServicesPropertyRanges.cs
- FlowDocumentPage.cs
- MemberHolder.cs
- DataGridViewHeaderCell.cs
- SelectedPathEditor.cs
- AssemblyHash.cs
- SchemaElementDecl.cs
- WebBrowserUriTypeConverter.cs
- BindUriHelper.cs
- XmlProcessingInstruction.cs
- BidOverLoads.cs
- HttpCookiesSection.cs
- LateBoundBitmapDecoder.cs
- NamespaceList.cs
- BackStopAuthenticationModule.cs
- ExpressionConverter.cs
- ButtonBaseAutomationPeer.cs
- CharacterString.cs
- LabelLiteral.cs
- ArrayConverter.cs
- PlatformNotSupportedException.cs
- WindowVisualStateTracker.cs
- FixedDocumentSequencePaginator.cs
- FullTextBreakpoint.cs
- UnsupportedPolicyOptionsException.cs
- XmlEntityReference.cs
- XmlMtomWriter.cs
- NativeMethods.cs
- XamlWriter.cs
- EnumMember.cs
- EventMappingSettingsCollection.cs
- ValueSerializerAttribute.cs
- InputReferenceExpression.cs
- EntitySqlQueryState.cs
- SequenceDesigner.cs
- BinaryConverter.cs
- LinkedList.cs
- XmlAnyElementAttributes.cs
- GridSplitter.cs
- GatewayIPAddressInformationCollection.cs
- ApplicationException.cs