0

Now I play correctly MP3 and WAV file with VLC. How can I check if there is an already running session of VLC and close it before playing a new file ?(without using Mutex)

Here's my code

int TfMain::play(char *filename)
    {

    const char *appname = "c:\\Program Files\\VideoLAN\\VLC\\vlc.exe";

    STARTUPINFOA si;
    PROCESS_INFORMATION pi;
    memset(&si, 0, sizeof(si));
    si.cb = sizeof(si);
    memset(&pi, 0, sizeof(pi));

    char buf[MAX_PATH + 300];
    wsprintfA(buf, "%s \"%s\" --play-and-exit", appname, filename);
    CreateProcessA(0, buf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);

    return 0;
}
  • 1
    Possible duplicate of [Is using a Mutex to prevent multiple instances of the same program from running safe?](https://stackoverflow.com/questions/646480/is-using-a-mutex-to-prevent-multiple-instances-of-the-same-program-from-running) – Mohammad Kanan Mar 21 '18 at 17:31
  • @MohammadKanan without using Mutex if it is possible –  Mar 22 '18 at 09:27

0 Answers0