int main(void) { HANDLE hE = CreateEvent(NULL,false,true,L"{@0001_Start_Program_Event}"); if ( GetLastError() == ERROR_ALREADY_EXISTS ) { //program running return 0; } Singleton* log = Singleton::Instance(); Server server; if ( server.Activate() ) { cout << "ok" << endl; } int k = 10; while (k) { system("cls"); log->Show(); system("@pause"); k--; if (k == 1) { server.Deactivate(); //END THREADS } } system("@Pause"); return 0; }
int main() { Singleton *st = Singleton::GetInstance("SingletonA"); st->Show(); return 0; }