Advertisement
fastman92

Untitled

Mar 27th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. signed int __cdecl isAlreadyRunning()
  2. {
  3.   HWND v0; // eax@2
  4.   signed int result; // eax@3
  5.  
  6.   CreateEventA(0, 0, 1, AppClassName);
  7.   if ( GetLastError() == ERROR_ALREADY_EXISTS )
  8.   {
  9.     v0 = FindWindowA(AppClassName, (LPCSTR)RsGlobal.AppName);
  10.     if ( v0 )
  11.     {
  12.       SetForegroundWindow(v0);
  13.       result = 1;
  14.     }
  15.     else
  16.     {
  17.       SetForegroundWindow(RsGlobal.ps->window);
  18.       result = 1;
  19.     }
  20.   }
  21.   else
  22.   {
  23.     result = 0;
  24.   }
  25.   return result;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement