| 发表于:2007-07-27 12:05:203楼 得分:100 |
这是按叠放次序的方法: module 内 =================== private declare function enumchildwindows lib "user32 " (byval hwndparent as long, byval lpenumfunc as long, byval lparam as long) as long private declare function getclassname lib "user32 " alias "getclassnamea " (byval hwnd as long, byval lpclassname as string, byval nmaxcount as long) as long private childforms as collection private function windowclassname(byval hwnd as long) as string dim retval as long, sclassname as string sclassname = space(256) retval = getclassname(hwnd, sclassname, 256) windowclassname = left$(sclassname, retval) end function public function enumchildproc(byval hwnd as long, byval lparam as long) as long dim frm as form if windowclassname(hwnd) = "thunderformdc " then ' for each frm in forms if frm.hwnd = hwnd then childforms.add frm end if next end if enumchildproc = 1 end function public function listchildforms(byval mdimain as mdiform) as collection set childforms = new collection enumchildwindows mdimain.hwnd, addressof enumchildproc, byval 2& set listchildforms = childforms end function =================== 主窗体内测试 =================== private sub mnuwindow_click() dim childforms as collection dim frm as form set childforms = listchildforms(me) for each frm in childforms debug.print frm.caption next end sub | | |
|