mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05: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);
|
bool utf8, DWORD helpctxid);
|
||||||
void MakeDlgItemBorderless(HWND parent, int id);
|
void MakeDlgItemBorderless(HWND parent, int id);
|
||||||
char *GetDlgItemText_alloc(HWND hwnd, 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,
|
void split_into_argv(char *, bool includes_program_name,
|
||||||
int *, char ***, char ***);
|
int *, char ***, char ***);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Handy wrapper around GetDlgItemText which doesn't make you invent
|
* Handy wrappers around GetDlgItemText (A and W) which don't make you
|
||||||
* an arbitrary length limit on the output string. Returned string is
|
* invent an arbitrary length limit on the output string. Returned
|
||||||
* dynamically allocated; caller must free.
|
* string is dynamically allocated; caller must free.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
@ -18,3 +18,16 @@ char *GetDlgItemText_alloc(HWND hwnd, int id)
|
|||||||
|
|
||||||
return ret;
|
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…
x
Reference in New Issue
Block a user