Skip to content

Commit

Permalink
Test result of global lock in CMainFrame::OnCopyScreenSize (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
xezon authored Sep 9, 2024
1 parent 42ee6c9 commit 45696cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tools/w3dviewer/mainfrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,8 +1251,11 @@ void CMainFrame::OnCopyScreenSize()
str.Format("MaxScreenSize=%f", size);
int len = str.GetLength() + 1;
HGLOBAL global = GlobalAlloc(GHND, len);
memcpy(GlobalLock(global), static_cast<const char *>(str), len);
GlobalUnlock(global);
LPVOID mem = GlobalLock(global);
if (mem != NULL) {
memcpy(mem, static_cast<const char *>(str), len);
GlobalUnlock(global);
}
OpenClipboard();
EmptyClipboard();
SetClipboardData(CF_TEXT, global);
Expand Down

0 comments on commit 45696cc

Please sign in to comment.