C 取得正在執行的程式的數量

2021-06-03 13:03:35 字數 1802 閱讀 8759

[dllimport("user32", setlasterror = true)]

public static extern int getwindowtext(intptr hwnd, stringbuilder lpstring, int nmaxcount);

[dllimport("user32.dll")]

extern static intptr getforegroundwindow();

[dllimport("user32")]

private extern static int getwindow(int hwnd, int wcmd);

[dllimport("user32")]

private extern static int getwindowlonga(int hwnd, int windx);

[dllimport("user32", charset = charset.auto)]

private extern static int getwindowtextlength(intptr hwnd);

[dllimport("user32.dll")]

private static extern bool getwindowtext(int hwnd, stringbuilder title, int maxbufsize);

private delegate bool wndenumproc(intptr hwnd, int lparam);

[dllimport("user32.dll")]

private static extern bool enumwindows(wndenumproc lpenumfunc, int lparam);

[dllimport("user32.dll")]

private static extern int getwindowtextw(intptr hwnd, [marshalas(unmanagedtype.lpwstr)]stringbuilder lpstring, int nmaxcount);

[dllimport("user32.dll")]

private static extern int getclassnamew(intptr hwnd, [marshalas(unmanagedtype.lpwstr)]stringbuilder lpstring, int nmaxcount);

[dllimport("user32")]

public extern static int getwindowthreadprocessid(intptr hwnd, ref int lpdwprocessid);

public struct windowinfo

private const int gw_hwndfirst = 0;

private const int gw_hwndnext = 2;

private const int gwl_style = (-16);

private const int ws_visible = 268435456;

private const int ws_border = 8388608;

private static string getmodulenamefromhandle(intptr hwnd)

//返回包含searchstr的程序的數量

try}

}hwcurr = getwindow(hwcurr, gw_hwndnext);}}

catch (exception ex)

finally

}

android監聽正在執行的程式

有時候要在程式中監聽系統中正在執行的程式,或者說監聽當前的activity中哪乙個。下面是過程 得到activity管理服務 activitymanager mactivitymanager activitymanager getsystemservice activity service 2.得到...

Matlab 終止正在執行的程式

終止matlab正在執行的程式,一般有三種方法。ctrl c ctrl break ctrl alt break 如果是在服務bai器上跑的 的話,按完快捷鍵之後有時候需要等一小會,程式才會停。有時候跑matlab記憶體占用過高,會有宕機的情況,這時候可以關閉matlab優化程式。關閉matlab可...

正在執行的SQL

sql server select spid session id,ecid,database db name sp.dbid user nt username,status er.status,wait wait type,individual query substring qt.text,er...