Use SendMessage(wm_Quit) to close
I use the streamer as a helper app for a windows program I develop myself. When my program is started the streamer is started by it in the background and upon closing the streamer is closed, too:
//start
ShellExecute(0, 'open', GetQuotedChar(StreamerExe), nil, nil, sw_Hide);
//close
SendMessage(StreamerHandle, wm_Close, 0, 0);
Starting is working well, but closing has some issues. I want to use the “Minimize to tray when closing” setting of the streamer, but this (obviously) causes my close command to “fail”. I could use taskkill to force closing of the streamer, but this prevents “Auto-mute/unmute desktop audio” from working (again, no surprise…).
Would it be possible that the streamer reacts to wm_Quit to be closed? Any ideas?
Is it possible to do the auto-mute with the API: https://github.com/SamDel/ChromeCast-Desktop-Audio-Streamer/wiki#rest-api.
In combination with Powershell - Invoke-WebRequest: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.5 ?
So, you recommend that I plainly taskkill the streamer and take care of the un-muting of my machine afterwards myself?
I can't think of another solution.
I don't think it's possible to catch WM_QUIT, because the message loop is in a .Net dll (here in code).
If there's a way to change the logic of the WM_CLOSE behaviour that works for you then let it know! (here in code)