How to declare the FindWindow function.

xiaoxiao2021-03-06  87

[DLLIMPORT ("User32.dll")] Private static extern INTPTR FINDWINDOW (String LpWindown);

// Open Up Blank Notepad First! String LpszparentClass = "Notepad"; string lpszparentWindow = "Untitled - NOTEPAD"; string lpszclass = "edit";

IntPtr ParenthWnd = new IntPtr (0); IntPtr hWnd = new IntPtr (0); ParenthWnd = FindWindow (lpszParentClass, lpszParentWindow); if (ParenthWnd.Equals (IntPtr.Zero)) Console.WriteLine ( "Notepad Not Running"); else {HWnd = FindWindowEx (PARENTHWND, HWND, LPSZCLASS, ""); if (HWND.Equals (INTPTR.ZERO)) Console.Writeline ("What THE F ??? NOTEPAD DOESN '' '' '' '' '的{Console.Writeline ("Notepad Window:" PARENTHWND.TOSTRING ()); console.writeline ("Edit Control:" hwnd.toTString ());}}

转载请注明原文地址:https://www.9cbs.com/read-108131.html

New Post(0)