查詢窗體是否已建立

2021-04-12 23:07:46 字數 807 閱讀 7916

查詢窗體是否已經建立,常用於避免彈出同乙個form。

2005下使用:

///

/// 查詢是否已建立窗體

///

/// 窗體name

///

2003下使用:

[dllimport("user32.dll", entrypoint = "findwindow")]

private static extern intptr findwindow(string lpclassname, string lpwindowname);

[dllimport("user32.dll", entrypoint = "findwindowex")] //找子窗體

private static extern intptr findwindowex(intptr hwndparent, intptr hwndchildafter, string lpszclass, string lpszwindow);

[dllimport("user32.dll", entrypoint = "sendmessage")] //用於傳送資訊給窗體

private static extern int sendmessage(intptr hwnd, int msg, intptr wparam, string lparam);

///

/// 查詢是否已建立窗體

///

/// 標題名稱

///

public static bool searchform(string formtitle)

else

}

判斷frame是否已建立 類的建立

1.士兵 許三多 有一把 ak47 2.士兵 可以 3.槍 能夠 發射 子彈 4.槍 裝填 子彈 增加子彈數量 class gun def init self,type self.type type 剛開始槍沒有子彈 self.bullet count 0 def str self return s...

自定已窗體進行漸變效果!

using system using system.collections.generic using system.componentmodel using system.data using system.drawing using system.linq using system.text u...

根據窗體名稱動態建立窗體

unit unit1 inte ce uses windows,messages,sysutils,variants,classes,graphics,controls,forms,dialogs,stdctrls,buttons,comctrls,db,adodb type tform1 clas...