Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
172:0fc45e386376 | 173:c2b5d0019ec3 |
---|---|
4303 * Returns: | 4303 * Returns: |
4304 * text: The text associsated with a given window. | 4304 * text: The text associsated with a given window. |
4305 */ | 4305 */ |
4306 char *dw_window_get_text(HWND handle) | 4306 char *dw_window_get_text(HWND handle) |
4307 { | 4307 { |
4308 char tempbuf[4096] = ""; | 4308 int len = GetWindowTextLength(handle); |
4309 | 4309 char *tempbuf = calloc(1, len + 2); |
4310 GetWindowText(handle, tempbuf, 4095); | 4310 |
4311 tempbuf[4095] = 0; | 4311 GetWindowText(handle, tempbuf, len + 1); |
4312 | 4312 |
4313 return strdup(tempbuf); | 4313 return tempbuf; |
4314 } | 4314 } |
4315 | 4315 |
4316 /* | 4316 /* |
4317 * Disables given window (widget). | 4317 * Disables given window (widget). |
4318 * Parameters: | 4318 * Parameters: |