I have the HWND of a window which has some audio output. How can I capture the magnitude like the windows mixer is doing it?
this is the code how to get the HWND of all windows:
BOOL CALLBACK FindWindowBySubstr(HWND hWnd, LPARAM substring)
{
const DWORD TITLE_SIZE = 1024;
TCHAR windowTitle[TITLE_SIZE];
std::string sTitle = CWinAPI::GetTheWindowText(hWnd);
unsigned int nTitleLength = CWinAPI::GetWindowTextlength(hWnd);
RECT rect = CWinAPI::GetWindowRectangle(hWnd);
if(nTitleLength > 0)
{
vecAllWindows.push_back(CWinAPI::SWindow(hWnd, sTitle, nTitleLength, rect));
}
return true; // Need to continue enumerating windows
}
void CWinAPI::ListAllWindows(bool bShowWindowsWithoutTitle)
{
vecAllWindows.clear();
const TCHAR substring[] = TEXT("A");
EnumWindows(FindWindowBySubstr, (LPARAM)substring);
}
from that list I can select the window I am looking for.
The following picture is the Microsoft windows audio mixer:
sorry, that this is in german, but I hope everyone understands... What i am trying to do is to capture the actual values of the current audio (magnitude) of my specific window HWND.
Is it possible? Is it also possible with the windows api? If so: which command can help me?
EDIT:
This code gives me the processID (maybe this is more usefull)
DWORD CWinAPI::GetProcessIDFromHWND(HWND hWnd)
{
return GetWindowThreadProcessId(hWnd, NULL);
}