daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    class Handler
  2.     {
  3.         // win native functions we have to load from user32.dll
  4.         [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
  5.         public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
  6.  
  7.         // win native functions we have to load from user32.dll
  8.         [DllImport("USER32.DLL")]
  9.         public static extern bool SetForegroundWindow(IntPtr hWnd);
  10.  
  11.         public static void bringToFront(string title)
  12.         {
  13.             // Get a handle to the application.
  14.             IntPtr handle = FindWindow(null, title);
  15.  
  16.             // Verify that app is a running process.
  17.             if (handle == IntPtr.Zero)
  18.             {
  19.                 return;
  20.             }
  21.  
  22.             // Make the appp the foreground application
  23.             SetForegroundWindow(handle);
  24.         }
  25.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top