Skip to content

Instantly share code, notes, and snippets.

@polovik
Last active August 29, 2015 13:59
Show Gist options
  • Save polovik/10714135 to your computer and use it in GitHub Desktop.
Save polovik/10714135 to your computer and use it in GitHub Desktop.
Verify unique instance of application in Qt
#include <QSharedMemory>
int main(int argc, char *argv[])
{
// Verify unique instance of application
QSharedMemory sharedMemory("service");
if (sharedMemory.attach())
return EXIT_FAILURE;
if (!sharedMemory.create(1))
return EXIT_FAILURE;
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment