Friday, August 12, 2005

Getting the screen handle of a window


[DllImport("USER32.DLL", SetLastError=true)]
private static extern uint FindWindow (string lpClassName, string lpWindowName);

private IntPtr GetScreenHandle(string windowTitle){
uint handle= FindWindow(null,windowTitle);
IntPtr screenHandle= new IntPtr(handle);
return screenHandle;
}