tags:

views:

307

answers:

1

The following example doesn't work, obviously. My question is how to make it work.

array<String^>^ MyRefClass::GetAvailableInputs()
{
 List<String^>^ result = gcnew List<String^>();
 DirectSoundCaptureEnumerate(&DSEnumCallback, &result);
 return result->ToArray();
}

BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription, 
                                 LPCWSTR lpcstrModule, LPVOID lpContext)
{
 ((List<String^>^)lpContext)->Add(gcnew String(lpcstrDescription));
 return TRUE;
}
A: 

Use pin_ptr

hjb417
You can use pin_ptr only on integral type data members. The only managed reference types to expose those are managed arrays of integral types.
CannibalSmith