728x90
반응형
// qt.single.instance.cpp
//
// code from http://blog.naver.com/PostView.nhn?blogId=browniz1004&logNo=220957590867&categoryNo=15&parentCategoryNo=0&viewDate=&currentPage=8&postListTopCurrentPage=&from=postList&userTopListOpen=true&userTopListCount=5&userTopListManageOpen=false&userTopListCurrentPage=8
#include "mainwindow.h"
#include <QApplication>
#include <QSharedMemory>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
QSharedMemory shared("HelloWorld");
if(!shared.create(512,QSharedMemory::ReadWrite))
{
QMessageBox::information(&w,QObject::tr("HelloWorld"),QObject::tr("It's already running"),QMessageBox::Ok);
exit(0);
}
w.show();
return a.exec();
}
728x90
반응형

+ Recent posts