ANSWER: Get the processes currently running using Process.GetProcesses(); and wants you got all the processes filter through them checking if they include anything that might link to the media player using and if statement and Process.MainWindowTitle.Contains("something about media player");
Hello Stack Overflow Users!
I am currently running into a problem developing my program. I am trying to grab the current window text from Clementine - A Media Player. The way I usually grab window titles is like this:
IntPtr ClementineWindow = FindWindow("QWidget", null);
string CurrentSong = new string((char)0, 100);
int WindowTitle = GetWindowText(ClementineWindow, CurrentSong, CurrentSong.Length);
But after looking into it, it will either return a number (0) or nothing. I noticed in WinSpy++ that a lot of the child windows are using the same class name "QWidget" an image can be seen below showing this:
Currently, I tried grabbing the window title using handle but I don't quite think I got the hang of that. Any help would be greatly appreciated. Thank you all!
I should also note that the way I usually grab window handles uses the FindWindow and GetWindowText things from user32 DLL.
question from:
https://stackoverflow.com/questions/65865771/get-window-title-using-class-with-same-class-name 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…