Clipboard changes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@986 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a465d5662a
commit
ae8203b7da
1 changed files with 6 additions and 4 deletions
|
@ -36,15 +36,17 @@ void SetBranding(HWND hwnd) {
|
|||
}
|
||||
|
||||
void CopyToClipboard(HWND hwnd) {
|
||||
if (!hwnd||!OpenClipboard(hwnd)) return;
|
||||
int len=SendDlgItemMessage(hwnd,IDC_LOGWIN,WM_GETTEXTLENGTH,0,0);
|
||||
HGLOBAL mem = GlobalAlloc(GHND,len);
|
||||
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE,len+1);
|
||||
if (!mem) { CloseClipboard(); return; }
|
||||
char *existing_text = (char *)GlobalLock(mem);
|
||||
if (!hwnd||!OpenClipboard(hwnd)||!existing_text) return;
|
||||
if (!existing_text) { CloseClipboard(); return; }
|
||||
EmptyClipboard();
|
||||
existing_text[0]=0;
|
||||
GetDlgItemText(hwnd, IDC_LOGWIN, existing_text, len);
|
||||
GetDlgItemText(hwnd, IDC_LOGWIN, existing_text, len+1);
|
||||
GlobalUnlock(mem);
|
||||
SetClipboardData(CF_TEXT,existing_text);
|
||||
SetClipboardData(CF_TEXT,mem);
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue