Länge einer WAV Datei ermitteln (MCI-Problem)

WorldRacer

Erfahrenes Mitglied
Hi,

habe bei folgendem Code ein Problem:

Code:
[DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = System::Runtime::InteropServices::CharSet::Unicode)]
			 int mciSendString(System::String^ lpstrCommand,
				 System::Text::StringBuilder^ lpstrReturnString, int uReturnLength, System::IntPtr
					hwndCallback);
			 System::Double mciGetLength(System::String^ file){
				 System::String^ mciString = "open \"" + file +
										"\" type waveaudio alias TempMCI";
				 System::Text::StringBuilder^ returnstr = gcnew System::Text::StringBuilder(261);
				 System::IntPtr ptr;
				 mciSendString(mciString, returnstr, 0, System::IntPtr::Zero );
				  mciString = "status TempMCI length";
				 int result = mciSendString(mciString, returnstr, returnstr->Capacity, System::IntPtr::Zero);
				 

				 mciSendString("play TempMCI from 0", returnstr, returnstr->Capacity, System::IntPtr::Zero);
				 mciSendString("put TempMCI destination", returnstr, returnstr->Capacity, System::IntPtr::Zero);

				 System::Windows::Forms::MessageBox::Show(returnstr->ToString());

				 return 0;
			 }

Und zwar ist es so, dass er zwar die Datei abspielt aber die Länge nicht ausgibt. Bekomme ein leeres Textfeld. Wozu ist eigentlich der StringBuilder da?

Danke im Vorraus

WR
 
Zurück