Ignore:
Timestamp:
Sep 14, 1999, 10:46:40 PM (26 years ago)
Author:
sandervl
Message:

Implemented Enum(Thread/Child)Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/window.cpp

    r903 r934  
    1 /* $Id: window.cpp,v 1.24 1999-09-10 19:00:11 dengert Exp $ */
     1/* $Id: window.cpp,v 1.25 1999-09-14 20:46:40 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    2424#include "user32.h"
    2525#include "winicon.h"
    26 #include "usrcall.h"
    2726
    2827//******************************************************************************
     
    983982BOOL WIN32API EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
    984983{
    985  BOOL                rc;
    986  EnumWindowCallback *callback = new EnumWindowCallback(lpfn, lParam);
    987 
    988   dprintf(("USER32:  EnumThreadWindows\n"));
    989   //CB: replace
    990   rc = O32_EnumThreadWindows(dwThreadId, callback->GetOS2Callback(), (LPARAM)callback);
    991   if(callback)
    992     delete callback;
    993   return(rc);
     984 Win32BaseWindow *window;
     985 BOOL   rc;
     986 ULONG  henum;
     987 HWND   hwndNext;
     988 ULONG  tid;
     989 ULONG  pid, curpid;
     990
     991  dprintf(("EnumThreadWindows\n"));
     992
     993  curpid = GetCurrentProcessId();
     994
     995  henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);         
     996  while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
     997  {
     998        OSLibWinQueryWindowProcess(hwndNext, &pid, &tid);
     999        if(!(curpid == pid && dwThreadId == tid))
     1000                continue;
     1001
     1002        window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1003        if(window == NULL) {
     1004                //OS/2 window or non-frame window, so skip it
     1005                continue;
     1006        }
     1007        if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
     1008                break;
     1009  }
     1010  OSLibWinEndEnumWindows (henum);
     1011  return TRUE;
     1012}
     1013//******************************************************************************
     1014//******************************************************************************
     1015BOOL WIN32API EnumChildWindows(HWND hwnd, WNDENUMPROC lpfn, LPARAM lParam)
     1016{
     1017 Win32BaseWindow *window, *parentwindow;
     1018 BOOL   rc = TRUE;
     1019 ULONG  henum;
     1020 HWND   hwndNext;
     1021
     1022  dprintf(("EnumChildWindows %x %x\n", hwnd, lParam));
     1023
     1024  parentwindow = Win32BaseWindow::GetWindowFromHandle(hwnd);
     1025  if(!parentwindow) {
     1026        dprintf(("EnumChildWindows, window %x not found", hwnd));
     1027        return FALSE;
     1028  }
     1029
     1030  henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);         
     1031  while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
     1032  {
     1033        window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1034        if(window == NULL) {
     1035                //OS/2 window or non-frame window, so skip it
     1036                continue;
     1037        }
     1038        if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE)
     1039        {
     1040                rc = FALSE;
     1041                break;
     1042        }
     1043  }
     1044  OSLibWinEndEnumWindows(henum);
     1045  return rc;
     1046}
     1047//******************************************************************************
     1048//******************************************************************************
     1049BOOL WIN32API EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
     1050{
     1051 Win32BaseWindow *window;
     1052 BOOL   rc;
     1053 ULONG  henum;
     1054 HWND   hwndNext, hwndParent = OSLIB_HWND_DESKTOP;
     1055
     1056  dprintf(("EnumThreadWindows\n"));
     1057
     1058  do {
     1059        henum = OSLibWinBeginEnumWindows(hwndParent);         
     1060        while ((hwndNext = OSLibWinGetNextWindow(henum)) != 0)
     1061        {
     1062                window = Win32BaseWindow::GetWindowFromHandle(hwndNext);
     1063                if(window == NULL) {
     1064                        //OS/2 window or non-frame window, so skip it
     1065                        continue;
     1066                }
     1067                if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
     1068                        goto Abort;
     1069                }
     1070        }
     1071        if(hwndParent == OSLIB_HWND_OBJECT)
     1072                break;
     1073        hwndParent = OSLIB_HWND_OBJECT;
     1074        OSLibWinEndEnumWindows(henum);
     1075  }
     1076  while(TRUE);
     1077
     1078Abort:
     1079  OSLibWinEndEnumWindows(henum);
     1080  return TRUE;
    9941081}
    9951082//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.