Win32 列舉所有子視窗二種方法

2021-05-25 02:44:11 字數 737 閱讀 3765

方法一通過api getwindow 遞迴列舉:

void outputwindow(hwnd hwnd)

;getwindowtext(hwnd, sztitle,

sizeof

(sztitle)

/sizeof

(tchar));

tchar szbuffer[max_path] =;

_sntprintf(szbuffer,

sizeof

(szbuffer)

/sizeof

(tchar) -1

, _t(

"hwnd(%x), title(%s)/n

"), (uint)hwnd, sztitle);

outputdebugstring(szbuffer);

}void

enumchild(hwnd hparent)}}

方法二 通過api enumchildwindows:

bool callback enumchildproc(hwnd hwnd, lparam lparam)

;getclassname(hwnd, sname, 128);

if(stricmp(sname, "xx")==0)

}return true;}

enumchildwindows(hwnd, enumchildproc, (lparam)&parentwnd);

強烈推薦使用方法二!

Win32 登錄檔操作(2)列舉登錄檔

關於wow64的問題 32位程式執行在64位系統上操作登錄檔會出現問題,在上篇已經有詳細的說明了,因此,這一節不再重複。十。列舉鍵值 值項 regenumvalue函式 long winapi regenumvalue in hkey hkey,in dword dwindex,out lptstr...

java入門篇 (32)列舉類

三 jdk7的一些新特性 如果乙個類擁有有限個固定的物件,那麼這個類就是列舉類。定義列舉類 public class week override public string tostring 測試類 public class text1 如果只在裡面加入成員,輸出時將會把成員名字輸出。public ...

Win32登錄檔列舉

最近有點忙,因為設計了很久的專案終於開紿寫 了。但堅持寫博是我的習慣,於是這會兒吃了晚飯的休息時間記錄了一點登錄檔api 操作的東西。下面這段 主要是用來列舉windows mobile下的plug in,然後可以設定所有的plug in的enabled鍵值。但windows mobile 的plu...