Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- NameValueCollection.cs
- SimpleWorkerRequest.cs
- StringPropertyBuilder.cs
- NGCSerializationManagerAsync.cs
- HTTPNotFoundHandler.cs
- storagemappingitemcollection.viewdictionary.cs
- XmlTypeAttribute.cs
- TextServicesCompartment.cs
- LineSegment.cs
- XmlQueryRuntime.cs
- DataGridViewCellValueEventArgs.cs
- wgx_commands.cs
- CodeBinaryOperatorExpression.cs
- ModelItemImpl.cs
- StateFinalizationDesigner.cs
- SafeNativeMethodsMilCoreApi.cs
- PolyBezierSegmentFigureLogic.cs
- WorkflowItemsPresenter.cs
- XomlCompilerHelpers.cs
- Point.cs
- MemberDomainMap.cs
- XNodeSchemaApplier.cs
- NetTcpSecurity.cs
- ProxyDataContractResolver.cs
- HeaderedItemsControl.cs
- DbProviderFactory.cs
- DataServiceConfiguration.cs
- SoapServerMessage.cs
- PolyBezierSegment.cs
- CommonDialog.cs
- HttpApplication.cs
- ImmComposition.cs
- RtfToken.cs
- SqlProfileProvider.cs
- WsdlBuildProvider.cs
- WindowsGraphicsWrapper.cs
- ProgressPage.cs
- SimplePropertyEntry.cs
- SHA512.cs
- VisualTarget.cs
- EnumType.cs
- SqlCommandBuilder.cs
- DtrList.cs
- SurrogateEncoder.cs
- TextChangedEventArgs.cs
- XslNumber.cs
- StringSorter.cs
- AncestorChangedEventArgs.cs
- ExpressionBinding.cs
- ProxyOperationRuntime.cs
- XsdValidatingReader.cs
- NamedObject.cs
- OracleInternalConnection.cs
- SymmetricSecurityBindingElement.cs
- DESCryptoServiceProvider.cs
- indexingfiltermarshaler.cs
- DataGridColumn.cs
- IdnMapping.cs
- Debug.cs
- XmlHelper.cs
- DataStreamFromComStream.cs
- NavigationFailedEventArgs.cs
- MimePart.cs
- RotateTransform3D.cs
- _NTAuthentication.cs
- DataGridViewButtonCell.cs
- ForeignConstraint.cs
- SQLDecimalStorage.cs
- SoapExtensionTypeElement.cs
- ConfigurationSettings.cs
- QueryStringParameter.cs
- SQLConvert.cs
- EntityEntry.cs
- RectangleHotSpot.cs
- AssociatedControlConverter.cs
- GlobalProxySelection.cs
- XsltInput.cs
- SimpleWorkerRequest.cs
- FixedFlowMap.cs
- ToolstripProfessionalRenderer.cs
- DockProviderWrapper.cs
- SRGSCompiler.cs
- SaveFileDialog.cs
- DataGridCommandEventArgs.cs
- XmlFormatExtensionPointAttribute.cs
- Int16KeyFrameCollection.cs
- TableLayoutPanelBehavior.cs
- GeometryGroup.cs
- NavigationFailedEventArgs.cs
- Icon.cs
- TabControl.cs
- IgnoreFileBuildProvider.cs
- RowToFieldTransformer.cs
- EventHandlersStore.cs
- PermissionAttributes.cs
- Helpers.cs
- RegexRunner.cs
- EntityDataSource.cs
- TabletCollection.cs
- ConfigurationValidatorBase.cs