Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RowTypeElement.cs
- WorkflowMarkupSerializer.cs
- WebReferencesBuildProvider.cs
- UnauthorizedWebPart.cs
- TemplateModeChangedEventArgs.cs
- FontStyle.cs
- DbInsertCommandTree.cs
- ThumbButtonInfoCollection.cs
- CssStyleCollection.cs
- CapabilitiesPattern.cs
- jithelpers.cs
- __FastResourceComparer.cs
- CategoryAttribute.cs
- MethodImplAttribute.cs
- XPathItem.cs
- PointAnimationUsingPath.cs
- ProviderBase.cs
- TextHidden.cs
- ListViewInsertionMark.cs
- LinqDataSourceDisposeEventArgs.cs
- DataGridViewRowCancelEventArgs.cs
- SchemaObjectWriter.cs
- DataGridViewImageCell.cs
- XPathSelectionIterator.cs
- ObjectHandle.cs
- CompilerGlobalScopeAttribute.cs
- LassoHelper.cs
- LocalizationParserHooks.cs
- XmlCharCheckingWriter.cs
- EntityType.cs
- SecurityContextTokenCache.cs
- StylusPointPropertyUnit.cs
- DataGridViewCellConverter.cs
- ProviderConnectionPointCollection.cs
- SubordinateTransaction.cs
- StrongNameKeyPair.cs
- MILUtilities.cs
- ImplicitInputBrush.cs
- NavigationWindow.cs
- LookupBindingPropertiesAttribute.cs
- RoutedEventHandlerInfo.cs
- Decorator.cs
- DataServiceQueryProvider.cs
- ColorInterpolationModeValidation.cs
- WsatConfiguration.cs
- CheckoutException.cs
- BaseResourcesBuildProvider.cs
- PackUriHelper.cs
- OutputCacheModule.cs
- DataObjectMethodAttribute.cs
- ForwardPositionQuery.cs
- WeakEventManager.cs
- ManagementObject.cs
- ClipboardProcessor.cs
- XsltArgumentList.cs
- TreeViewAutomationPeer.cs
- SystemResourceKey.cs
- InlineCategoriesDocument.cs
- PolicyLevel.cs
- PathSegment.cs
- ScrollProperties.cs
- XmlObjectSerializer.cs
- ComponentChangingEvent.cs
- DataGridViewComboBoxCell.cs
- FormatPage.cs
- PeerApplicationLaunchInfo.cs
- TimeZone.cs
- ControlSerializer.cs
- ExecutionEngineException.cs
- DataGridState.cs
- ContractsBCL.cs
- InvokeBase.cs
- ReflectionUtil.cs
- RectAnimationUsingKeyFrames.cs
- MediaPlayer.cs
- SrgsItemList.cs
- SoundPlayer.cs
- WmlTextViewAdapter.cs
- BuildDependencySet.cs
- CacheSection.cs
- Closure.cs
- ListenUriMode.cs
- ImageMetadata.cs
- CodeDirectiveCollection.cs
- WizardForm.cs
- ParserOptions.cs
- RsaKeyIdentifierClause.cs
- IisTraceListener.cs
- Size.cs
- NotificationContext.cs
- DataErrorValidationRule.cs
- GradientBrush.cs
- DataGridViewCellParsingEventArgs.cs
- InputManager.cs
- ToolStripItem.cs
- XmlSerializerFactory.cs
- SoundPlayer.cs
- LassoHelper.cs
- DataSourceViewSchemaConverter.cs
- HttpBrowserCapabilitiesBase.cs