Ignore:
Timestamp:
Oct 23, 2000, 8:28:53 PM (25 years ago)
Author:
sandervl
Message:

GetWindowText(Lenght)A/W fixes for windows belonging to different processes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r4515 r4524  
    1 /* $Id: win32wbase.cpp,v 1.219 2000-10-22 16:07:48 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.220 2000-10-23 18:28:53 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    30643064}
    30653065//******************************************************************************
     3066//When using this API for a window that was created by a different process, NT
     3067//does NOT send WM_GETTEXTLENGTH.
    30663068//******************************************************************************
    30673069int Win32BaseWindow::GetWindowTextLength()
    30683070{
    3069     return SendInternalMessageA(WM_GETTEXTLENGTH,0,0);
    3070 }
    3071 //******************************************************************************
     3071    //if the destination window is created by this process, send message
     3072    if(dwProcessId == currentProcessId) {
     3073        return SendInternalMessageA(WM_GETTEXTLENGTH,0,0);
     3074    }
     3075    //else get data directory from window structure
     3076    return wndNameLength;
     3077}
     3078//******************************************************************************
     3079//When using this API for a window that was created by a different process, NT
     3080//does NOT send WM_GETTEXT.
    30723081//******************************************************************************
    30733082int Win32BaseWindow::GetWindowTextA(LPSTR lpsz, int cch)
    30743083{
    3075     return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
    3076 }
    3077 //******************************************************************************
     3084    //if the destination window is created by this process, send message
     3085    if(dwProcessId == currentProcessId) {
     3086        return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     3087    }
     3088    //else get data directory from window structure
     3089    if (!lpsz || !cch) return 0;
     3090    if (!windowNameA) lpsz[0] = 0;
     3091    else lstrcpynA(lpsz, windowNameA, cch);
     3092    return min(wndNameLength, cch);
     3093}
     3094//******************************************************************************
     3095//When using this API for a window that was created by a different process, NT
     3096//does NOT send WM_GETTEXT.
    30783097//******************************************************************************
    30793098int Win32BaseWindow::GetWindowTextW(LPWSTR lpsz, int cch)
    30803099{
    3081     return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
    3082 }
    3083 //******************************************************************************
     3100    //if the destination window is created by this process, send message
     3101    if(dwProcessId == currentProcessId) {
     3102        return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     3103    }
     3104    //else get data directory from window structure
     3105    if (!lpsz || !cch) return 0;
     3106    if (!windowNameW) lpsz[0] = 0;
     3107    else lstrcpynW(lpsz, windowNameW, cch);
     3108    return min(wndNameLength, cch);
     3109}
     3110//******************************************************************************
     3111//TODO: How does this work when the target window belongs to a different process???
    30843112//******************************************************************************
    30853113BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz)
Note: See TracChangeset for help on using the changeset viewer.