mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
New Windows utility function: GetDlgItemTextW_alloc.
Just like the existing GetDlgItemText_alloc, but for wide strings.
This commit is contained in:
parent
392be3e494
commit
059f42aa56
@ -402,6 +402,7 @@ int message_box(HWND owner, LPCTSTR text, LPCTSTR caption, DWORD style,
|
||||
bool utf8, DWORD helpctxid);
|
||||
void MakeDlgItemBorderless(HWND parent, int id);
|
||||
char *GetDlgItemText_alloc(HWND hwnd, int id);
|
||||
wchar_t *GetDlgItemTextW_alloc(HWND hwnd, int id);
|
||||
void split_into_argv(char *, bool includes_program_name,
|
||||
int *, char ***, char ***);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Handy wrapper around GetDlgItemText which doesn't make you invent
|
||||
* an arbitrary length limit on the output string. Returned string is
|
||||
* dynamically allocated; caller must free.
|
||||
* Handy wrappers around GetDlgItemText (A and W) which don't make you
|
||||
* invent an arbitrary length limit on the output string. Returned
|
||||
* string is dynamically allocated; caller must free.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
@ -18,3 +18,16 @@ char *GetDlgItemText_alloc(HWND hwnd, int id)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
wchar_t *GetDlgItemTextW_alloc(HWND hwnd, int id)
|
||||
{
|
||||
wchar_t *ret = NULL;
|
||||
size_t size = 0;
|
||||
|
||||
do {
|
||||
sgrowarray_nm(ret, size, size);
|
||||
GetDlgItemTextW(hwnd, id, ret, size);
|
||||
} while (!memchr(ret, '\0', size-1));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user