Mercurial > dwindows
diff win/dw.c @ 173:c2b5d0019ec3
Updated dw_window_get_text() on Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 01 Dec 2002 11:18:14 +0000 |
parents | 627e531ca530 |
children | e3dd5c765775 |
line wrap: on
line diff
--- a/win/dw.c Sun Dec 01 11:11:41 2002 +0000 +++ b/win/dw.c Sun Dec 01 11:18:14 2002 +0000 @@ -4305,12 +4305,12 @@ */ char *dw_window_get_text(HWND handle) { - char tempbuf[4096] = ""; - - GetWindowText(handle, tempbuf, 4095); - tempbuf[4095] = 0; - - return strdup(tempbuf); + int len = GetWindowTextLength(handle); + char *tempbuf = calloc(1, len + 2); + + GetWindowText(handle, tempbuf, len + 1); + + return tempbuf; } /*