Hi ,I am using QT4.4 open source ,I have problem that If I click on my application second time, I get two same applications running at the same time. I tried this as shown below .
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4. QFile lockFile("E:\\lockFile.lock");
  5. if (lockFile.isOpen())
  6. {
  7. QMessageBox::about(0, "Attention", "The app is already running");
  8. exit(1);
  9. }
  10. lockFile.open(QFile::WriteOnly);
  11. lpsu_application lp;
  12. lp.show();
  13. return a.exec();
  14. }
To copy to clipboard, switch view to plain text mode 

But it is not working.I think the first application creates the file but it does not "hold" it and the next one does not see that the file is open.
So help me to solve this problem with out using QtSingleApplication() class.

With Regards,
Sudheeer