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
- AttachedPropertyBrowsableAttribute.cs
- ConfigXmlAttribute.cs
- BrowserDefinitionCollection.cs
- AttributeEmitter.cs
- ViewStateException.cs
- SendDesigner.xaml.cs
- ValidationUtility.cs
- TextComposition.cs
- MemoryMappedFile.cs
- SamlSerializer.cs
- HeaderedItemsControl.cs
- MsmqBindingMonitor.cs
- TemplatedEditableDesignerRegion.cs
- SRef.cs
- SpecialNameAttribute.cs
- CompoundFileStorageReference.cs
- DispatcherObject.cs
- DataGridViewComboBoxColumn.cs
- TraceLevelStore.cs
- DataGridTablesFactory.cs
- UmAlQuraCalendar.cs
- UInt32Converter.cs
- QueryConverter.cs
- FileInfo.cs
- EventDriven.cs
- SuppressMessageAttribute.cs
- HttpDictionary.cs
- HttpListener.cs
- CompiledRegexRunnerFactory.cs
- NetCodeGroup.cs
- WebBrowserDocumentCompletedEventHandler.cs
- BitHelper.cs
- NumericUpDownAcceleration.cs
- DataServiceException.cs
- StyleTypedPropertyAttribute.cs
- ClosureBinding.cs
- DesigntimeLicenseContextSerializer.cs
- MembershipSection.cs
- WebBrowserBase.cs
- TabPage.cs
- VBCodeProvider.cs
- Message.cs
- SamlAction.cs
- DataServiceQueryOfT.cs
- DateTimePickerDesigner.cs
- CmsUtils.cs
- LambdaCompiler.Logical.cs
- ExpressionConverter.cs
- StringValidatorAttribute.cs
- XmlSchemaInfo.cs
- DrawingGroup.cs
- Timer.cs
- StrongNamePublicKeyBlob.cs
- recordstate.cs
- ToolStripSplitStackLayout.cs
- xmlsaver.cs
- Base64Encoder.cs
- CodePageUtils.cs
- DataServiceProviderMethods.cs
- EtwTrace.cs
- CodeStatementCollection.cs
- CellPartitioner.cs
- TargetException.cs
- MonikerProxyAttribute.cs
- ServiceCredentialsSecurityTokenManager.cs
- SystemIPGlobalStatistics.cs
- IntegerValidator.cs
- DynamicRendererThreadManager.cs
- LinqDataSourceEditData.cs
- IsolatedStorage.cs
- ColumnResizeAdorner.cs
- FontNamesConverter.cs
- AnimatedTypeHelpers.cs
- embossbitmapeffect.cs
- BitmapPalettes.cs
- X509Certificate2Collection.cs
- BaseAppDomainProtocolHandler.cs
- TrackingCondition.cs
- KeyBinding.cs
- DefaultValueConverter.cs
- CounterCreationDataCollection.cs
- TextServicesDisplayAttributePropertyRanges.cs
- ObjectDataSourceStatusEventArgs.cs
- IISMapPath.cs
- SettingsSavedEventArgs.cs
- QuaternionKeyFrameCollection.cs
- ScrollViewer.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- HtmlInputPassword.cs
- RegexCapture.cs
- IISMapPath.cs
- UITypeEditor.cs
- Activity.cs
- DesignerImageAdapter.cs
- StateMachine.cs
- XmlMemberMapping.cs
- NetMsmqBinding.cs
- OperationParameterInfoCollection.cs
- ComponentConverter.cs
- TreeBuilderBamlTranslator.cs