| | 63 | template TextImpl() { |
|---|
| | 64 | char[] text() { |
|---|
| | 65 | if (useWfuncs) { |
|---|
| | 66 | int len = SendMessageW(peer,WM_GETTEXTLENGTH,0,0); |
|---|
| | 67 | scope buffer = new wchar[len+1]; |
|---|
| | 68 | SendMessageW(peer,WM_GETTEXT,cast(WPARAM)(len+1),cast(LPARAM)buffer.ptr); |
|---|
| | 69 | return toUTF8(buffer[0..$-1]); |
|---|
| | 70 | } else { |
|---|
| | 71 | int len = SendMessageA(peer,WM_GETTEXTLENGTH,0,0); |
|---|
| | 72 | scope buffer = new char[len+1]; |
|---|
| | 73 | SendMessageA(peer,WM_GETTEXT,cast(WPARAM)(len+1),cast(LPARAM)buffer.ptr); |
|---|
| | 74 | return fromMBSz(buffer.ptr); |
|---|
| | 75 | } |
|---|
| | 76 | } |
|---|
| | 77 | // TODO: is the other way needed as well? |
|---|
| | 78 | private char[] lf_to_crlf(char[] str) { |
|---|
| | 79 | scope lines = std.string.splitlines(str); |
|---|
| | 80 | return std.string.join(lines,std.string.newline); |
|---|
| | 81 | } |
|---|
| | 82 | void text(char[] str) { |
|---|
| | 83 | scope winstr = lf_to_crlf(str); |
|---|
| | 84 | SendMessageX(peer,WM_SETTEXT,0,winstr); |
|---|
| | 85 | } |
|---|
| | 86 | } |
|---|
| | 87 | |
|---|