Re: Need Help With Windowing & INI Files
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 21, 2001
- 393 views
----- Original Message ----- From: <brian_keene at yahoo.com> To: "EUforum" <EUforum at topica.com> Subject: RE: Need Help With Windowing & INI Files > I don't have the SDK. So any help would be much appreciated. Hi Brian, here is a little program that lists all the window text in the system. ------------------ include win32lib.ew without warning integer win, lst1, SB constant xEnumWindows = registerw32Function(user32, "EnumWindows", {C_ULONG, C_ULONG}, C_ULONG) constant xEnumChildWindows = registerw32Function(user32, "EnumChildWindows", {C_ULONG, C_ULONG, C_ULONG}, C_ULONG) atom rc win = create(Window, "All Window Text", 0, 0, 0, 400, 400, 0) SB = create(StatusBar, sprintf("Win32lib v%d.%d(%d)", {Win32LibVersion[1], Win32LibVersion[2], Win32LibVersion[3] }) , win, 0, 0, 0, 0, 0) lst1 = create(List, "List of text items found", win, 5,5, 350, 340, 0) integer wcnt, ccnt wcnt = 0 ccnt = 0 function gettext(atom hWnd) atom tlen sequence text atom tbuf, tbuflen tlen = w32Func(xSendMessage, {hWnd, WM_GETTEXTLENGTH, 0, 0}) if tlen > 0 then tlen += 1 tbuf = acquire_mem(0, tlen) tbuflen = w32Func(xSendMessage, {hWnd, WM_GETTEXT, tlen, tbuf}) text = peek( {tbuf, tbuflen}) release_mem(tbuf) else text = "" end if return text end function function enumcw(atom hWnd, atom lParam) sequence text ccnt += 1 text = gettext(hWnd) addItem(lst1, sprintf("%4d %4d %s", {wcnt, ccnt, text})) return 1 end function function enumw(atom hWnd, atom lParam) atom rc sequence text ccnt = 0 wcnt += 1 text = gettext(hWnd) if length(text) > 0 then addItem(lst1, sprintf("Parent text '%s'", {text})) rc = w32Func(xEnumChildWindows, {hWnd, call_back(routine_id("enumcw")), 0}) end if return 1 end function rc = w32Func(xEnumWindows, {call_back(routine_id("enumw")), 0}) WinMain(win, Normal) ---------------- cheers, Derek