Useful WindowAPI

Useful WindowAPI

Posted by Kuo on January 6, 2016

Windows API

[DllImport("kernel32.dll")]
public static extern uint GetTickCount();

[DllImport("user32.dll",EntryPoint="FindWindowEx",SetLastError=true)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent,IntPtr hwndChilidAfter,string ipzClass,string ipzWindow);

[DllImport("user32.dll",EntryPoint="FindWindow",SetLastError=true)]
public static extern IntPtr FindWindow(string lpClassName,string lpWindowName);

[DllImport("user32.dll",EntryPoint="PostMessage",SetLastError=true)]
public static extern bool PostMessage(IntPtr hwnd,IntPtr wMsg,IntPtr wParam,IntPtr lParam);

[DllImport("user32.dll",EntryPoint="SetFocus",SetLastError=true)]
public static extern IntPtr SetFocus(IntPtr hwnd);

[DllImport("user32.dll",EntryPoint="SendMessage",SetLastError=true)]
public static extern IntPtr SendMessage(IntPtr hwnd,IntPtr wMsg,IntPtr wParam,string lParam);