Home > Net >  Enumerate audio capture device new CaptureDevicesCollection won't move on, what's wrong al
Enumerate audio capture device new CaptureDevicesCollection won't move on, what's wrong al

Time:02-08

The following code directly to crash? Excuse me what reason be
Environment: Windows 10
The testing process:
1, write the following code directly, not Microsoft, DirectX, and Microsoft DirectX. DirectSound reference, an error
2, download a directx12_x64, is actually directx_11_redist. Exe, after the installation, at C:\Windows\Microsoft.NET \ DirectX for Managed Code \ 1.0.2902.0 had the two DLL, I directly quote, compile error no longer, but a run, what's wrong all don't,
3, to download directx_9. 29.952. Exe, namely directX9, installation is complete (not uninstall directx_11), the two DLL file copy to my project, also copy a under debug, reference editing by running won't move on, what's wrong all don't quote?

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Using System. Windows. Forms;
Using Microsoft. DirectX;
. Using Microsoft DirectX. DirectSound;

The namespace RecordTest
{
Static class Program
{
///& lt; Summary>
///the application's main entry point,
///& lt;/summary>
[STAThread]
The static void Main ()
{
Try {
CaptureDevicesCollection devices=new CaptureDevicesCollection ();//to enumerate audio capture device===have crashed here
{} the catch (Exception ex)

}
Application. EnableVisualStyles ();
Application. SetCompatibleTextRenderingDefault (false);
Application. The Run (new _click ());
}
}
}

CodePudding user response:

Make it clear that my computer is with a microphone, can I use QQ tested, voice

CodePudding user response:

I changed a Windows 10 computer test: install directX9 (no directX11 this computer, but the default is Windows 10 directX12), the two DLL file copy to my project, the debug also copy a below, by reference to edit, run to the line, also did not move, not to what's wrong? Run as completed, but the subsequent code didn't actually run (I interrupt point)

CodePudding user response:

I found that this project will not start up, haven't run is one line of code, as if he had made a mistake that compile (but didn't see an error),
Because before CaptureDevicesCollection add a line: int a=1; Even can't execute it, just completed

Local code is as follows:

Int a=1;
Try {
CaptureDevicesCollection devices=new CaptureDevicesCollection ();//to enumerate audio capture device
{} the catch (Exception ex)

}
  •  Tags:  
  • C#
  • Related