Advertisement
ranveer5289

HookMessage

Mar 12th, 2012
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. using System.Windows.Forms;
  6.  
  7. internal class Win32
  8. {
  9.         [DllImport("user32.dll", SetLastError = true)]
  10.                 internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  11.  
  12. }
  13.  
  14. public enum WinMsg
  15. {
  16.         WM_SETTEXT = 12
  17. }
  18.  
  19.  
  20. class spotify : Form
  21. {
  22.         public IntPtr getspotify()
  23.         {
  24.                 return Win32.FindWindow("SpotifyMainWindow", null);
  25.  
  26.         }
  27. }
  28.  
  29. class Exampleclass
  30. {
  31.         public static void Main()
  32.         {
  33.                 spotify s = new spotify();
  34.                 IntPtr h = s.getspotify();
  35.                 System.Console.WriteLine("Hello world!");
  36.                 System.Console.WriteLine(h); // prints out 262990
  37.  
  38.         }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement