Normal
Okay - I know it's a bit mad responding to my own post but it may help somebody...I was wanting to use the Multishortcut plugin to start Maximus Arcade (an emulator front end) - this worked fine but I didn't want media portal hanging around in the background. Initially, I wrote a small program which took as parameters a string and an executable path. The program then searched out all windows containing the string and sent a WM_CLOSE to each - afterwards it ran the specified executable (in my case MaximusArcade).Unfortunately, testing revealed that the WM_CLOSE didn't seem to be doing the job consistently (I'm not sure why). I was not overly keen on using the TerminateProcess API as it is not generally recommended. Whilst researching I came across this Dr Dobbs article:h??p://www.drdobbs.com/windows/184416547?pgno=1...it offers a "safer" alternative to TerminateProcess (see the article for details - it's quite interesting).So... I have modified my program to send the WM_CLOSE, wait a user specified number of milliseconds and then check if the window is still present... if it is then a SafeTerminateProcess is used to kill the darn thing. It all seems to be working fine thus far and I am able to switch between Maximus Arcade and Mediaportal cleanly. Next on the list is Comic Rack.If anybody wants the source code they are welcome - just PM me.
Okay - I know it's a bit mad responding to my own post but it may help somebody...
I was wanting to use the Multishortcut plugin to start Maximus Arcade (an emulator front end) - this worked fine but I didn't want media portal hanging around in the background.
Initially, I wrote a small program which took as parameters a string and an executable path. The program then searched out all windows containing the string and sent a WM_CLOSE to each - afterwards it ran the specified executable (in my case MaximusArcade).
Unfortunately, testing revealed that the WM_CLOSE didn't seem to be doing the job consistently (I'm not sure why). I was not overly keen on using the TerminateProcess API as it is not generally recommended. Whilst researching I came across this Dr Dobbs article:
h??p://www.drdobbs.com/windows/184416547?pgno=1
...it offers a "safer" alternative to TerminateProcess (see the article for details - it's quite interesting).
So... I have modified my program to send the WM_CLOSE, wait a user specified number of milliseconds and then check if the window is still present... if it is then a SafeTerminateProcess is used to kill the darn thing. It all seems to be working fine thus far and I am able to switch between Maximus Arcade and Mediaportal cleanly. Next on the list is Comic Rack.
If anybody wants the source code they are welcome - just PM me.