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
- PerformanceCountersElement.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- KeyEvent.cs
- PlanCompiler.cs
- UnsafeNativeMethods.cs
- PKCS1MaskGenerationMethod.cs
- WebPartDisplayModeCollection.cs
- ProviderUtil.cs
- TextEditorTyping.cs
- PackageDigitalSignature.cs
- unitconverter.cs
- AspNetSynchronizationContext.cs
- DirectionalAction.cs
- NameScopePropertyAttribute.cs
- ResourceAttributes.cs
- DbFunctionCommandTree.cs
- CompressStream.cs
- Serializer.cs
- NetMsmqBinding.cs
- ALinqExpressionVisitor.cs
- ManipulationDevice.cs
- TableCell.cs
- DataControlPagerLinkButton.cs
- HtmlInputPassword.cs
- HtmlHead.cs
- DeferredTextReference.cs
- BitmapEffectDrawingContextWalker.cs
- ModuleConfigurationInfo.cs
- CacheChildrenQuery.cs
- OperatorExpressions.cs
- RadioButton.cs
- RSAOAEPKeyExchangeDeformatter.cs
- RoleServiceManager.cs
- DateTimePicker.cs
- SystemMulticastIPAddressInformation.cs
- TargetInvocationException.cs
- LoginView.cs
- RangeValueProviderWrapper.cs
- PointCollection.cs
- SocketException.cs
- RegexMatch.cs
- HandlerMappingMemo.cs
- NullableDoubleAverageAggregationOperator.cs
- ResourceExpression.cs
- AvtEvent.cs
- StylusPointPropertyId.cs
- SchemaObjectWriter.cs
- ActiveXSite.cs
- WebPartMovingEventArgs.cs
- QuestionEventArgs.cs
- ObjectFullSpanRewriter.cs
- ParseChildrenAsPropertiesAttribute.cs
- AsymmetricSignatureFormatter.cs
- SiteMapPath.cs
- Int16KeyFrameCollection.cs
- Imaging.cs
- Int16.cs
- TypeDelegator.cs
- Int32Storage.cs
- RoutedEventHandlerInfo.cs
- MetadataStore.cs
- XmlTextAttribute.cs
- ListViewSortEventArgs.cs
- ComponentChangingEvent.cs
- EntityDataReader.cs
- wgx_commands.cs
- RootBrowserWindowProxy.cs
- FileReservationCollection.cs
- XmlSchemaDocumentation.cs
- MethodToken.cs
- ObjectStateEntryDbDataRecord.cs
- StatusBarAutomationPeer.cs
- VariableDesigner.xaml.cs
- WorkflowMarkupSerializerMapping.cs
- XmlSerializationReader.cs
- ConfigUtil.cs
- FixedSOMPage.cs
- CodeChecksumPragma.cs
- HelpInfo.cs
- MailMessage.cs
- XmlSchemaDocumentation.cs
- CalendarDay.cs
- ColorKeyFrameCollection.cs
- ComponentResourceKeyConverter.cs
- RegistrationContext.cs
- DesignerFrame.cs
- AnnotationResourceCollection.cs
- WsdlImporter.cs
- ImportContext.cs
- RtfNavigator.cs
- EntityDataSourceSelectedEventArgs.cs
- SHA256.cs
- ConstantExpression.cs
- TableStyle.cs
- ParamArrayAttribute.cs
- ProfileParameter.cs
- HuffmanTree.cs
- MarkupExtensionParser.cs
- BufferModesCollection.cs
- ActivityInterfaces.cs