C # and reading sound from another process?

I am currently developing an application that interacts directly with a puzzle in C #. He is able to play on the screen, scraping the state of the game, and then decides for the next step that he must take.

The application captures the width and height of the game, viewing the process and capturing its rectangle, as shown below.

var p = Process.GetProcessesByName("game")[0];
var r = new User32.Rect();

// Bring the window to the foreground in order to get its coordinates.
User32.SetForegroundWindow(p.MainWindowHandle);
User32.GetWindowRect(p.MainWindowHandle, ref r);

// Get the width and height of the window.
int width = r.right - r.left;
int height = r.bottom - r.top;

I was interested to know if it is possible to find out if the same sound outputs a sound or not, and then somehow identifies this sound, if any. Sound is used to indicate several events, so if I could directly capture the sound from the process, I could improve the way my application handles several scenarios in the game.

, " " , , , , ? , , .

.

+3
1

, DLL-. - , Windows , .

Microsoft Research API: Windows Detours. , . API . , API 10 000 .

+1

Source: https://habr.com/ru/post/1770662/


All Articles