diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-17 23:16:29 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-17 23:16:29 +0900 |
commit | 3de8318e98ebc2be40154da33e326536723d980e (patch) | |
tree | ea0baa340bf9505c8fcc0318981dae8e758edad1 | |
parent | ac267ede504e506fca4916595eeb092dab4ccdb4 (diff) |
win32: fixed CRLF when copying to clipboard
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | win32/toneview.c | 15 |
2 files changed, 13 insertions, 4 deletions
@@ -1,6 +1,6 @@ #ifndef MYON_FMPLAYER_VERSION_H_INCLUDED #define MYON_FMPLAYER_VERSION_H_INCLUDED -#define FMPLAYER_VERSION_STR "0.1.0" +#define FMPLAYER_VERSION_STR "0.1.1" #endif // MYON_FMPLAYER_VERSION_H_INCLUDED diff --git a/win32/toneview.c b/win32/toneview.c index a0a920a..90ad24a 100644 --- a/win32/toneview.c +++ b/win32/toneview.c @@ -68,10 +68,19 @@ enum { static void on_command(HWND hwnd, int id, HWND hwnd_c, UINT code) { if (code == BN_CLICKED && ((ID_COPY0 <= id) && (id <= ID_COPY5))) { int i = id - ID_COPY0; - HGLOBAL gmem = GlobalAlloc(GMEM_MOVEABLE, FMPLAYER_TONEDATA_STR_SIZE*sizeof(wchar_t)); - if (!gmem) return; - wchar_t *buf = GlobalLock(gmem); + wchar_t buf[FMPLAYER_TONEDATA_STR_SIZE]; GetWindowText(g.tonelabel[i], buf, FMPLAYER_TONEDATA_STR_SIZE*sizeof(wchar_t)); + HGLOBAL gmem = GlobalAlloc(GMEM_MOVEABLE, (FMPLAYER_TONEDATA_STR_SIZE+10)*sizeof(wchar_t)); + if (!gmem) return; + wchar_t *gbuf = GlobalLock(gmem); + wchar_t *c = buf; + while (*c) { + if (*c == L'\n') { + *gbuf++ = L'\r'; + } + *gbuf++ = *c++; + } + *gbuf = 0; GlobalUnlock(gmem); if (!OpenClipboard(hwnd)) return; EmptyClipboard(); |