728x90
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// qt.single.instance.cpp | |
// | |
// code from http://blog.naver.com/PostView.nhn?blogId=browniz1004&logNo=220957590867&categoryNo=15&parentCategoryNo=0&viewDate=¤tPage=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
반응형
'C C++' 카테고리의 다른 글
Xlnt (2) 입문 예제 : Hello, Xlnt !! (1) | 2017.10.15 |
---|---|
Xlnt (1) 소개 : C++14 기반 excel(xlsx) 라이브러리 (0) | 2017.10.15 |
Determining 32 vs 64 bit in C++ (0) | 2017.09.07 |
함수의 인자를 const로 사용 (0) | 2014.12.07 |
복사방지 C++ 클래스(Class) 만들기 (0) | 2014.03.20 |