Changeset 60784 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray
- Timestamp:
- May 2, 2016 11:41:08 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106982
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r60772 r60784 99 99 { 100 100 /* "OpenClipboard fails if another window has the clipboard open." 101 * So try a few times and wait up to 1 second. 102 */ 103 int rc; 104 105 uint32_t u32SleepMS = 1; 106 int i; 107 for (i = 0; i <= 9; ++i) /* u32SleepMS = [1..512] */ 101 * So try a few times and wait up to 1 second. 102 */ 103 BOOL fOpened = FALSE; 104 105 int i = 0; 106 for (;;) 108 107 { 109 108 if (OpenClipboard(hwnd)) 110 109 { 111 rc = 0;110 fOpened = TRUE; 112 111 break; 113 112 } 114 rc = RTErrConvertFromWin32(GetLastError()); 115 116 RTThreadSleep(u32SleepMS); 117 u32SleepMS <<= 1; 118 } 113 114 if (i >= 10) /* sleep interval = [1..512] ms */ 115 break; 116 117 RTThreadSleep(1 << i); 118 ++i; 119 } 120 119 121 #ifdef LOG_ENABLED 120 122 if (i > 0) 121 LogFlow (("vboxOpenClipboard: %d times tried to open clipboard. \n", ++i));123 LogFlowFunc(("%d times tried to open clipboard.\n", i + 1)); 122 124 #endif 125 126 int rc; 127 if (fOpened) 128 rc = VINF_SUCCESS; 129 else 130 { 131 const DWORD err = GetLastError(); 132 LogFlowFunc(("error %d\n", err)); 133 rc = RTErrConvertFromWin32(err); 134 } 135 123 136 return rc; 124 137 } … … 131 144 /* Query list of available formats and report to host. */ 132 145 int rc = vboxOpenClipboard(pCtx->hwnd); 133 if (RT_SUCCESS(rc))146 if (RT_SUCCESS(rc)) 134 147 { 135 148 uint32_t u32Formats = 0; … … 502 515 * windows is to be destroyed and therefore the guest side becomes inactive. 503 516 */ 504 int res= vboxOpenClipboard(hwnd);505 if (RT_SUCCESS( res))517 int vboxrc = vboxOpenClipboard(hwnd); 518 if (RT_SUCCESS(vboxrc)) 506 519 { 507 520 EmptyClipboard(); … … 510 523 else 511 524 { 512 LogFlowFunc(("WM_RENDERALLFORMATS: Failed to open clipboard! rc: %Rrc\n", res));525 LogFlowFunc(("WM_RENDERALLFORMATS: Failed to open clipboard! rc: %Rrc\n", vboxrc)); 513 526 } 514 527 } break; … … 519 532 uint32_t u32Formats = (uint32_t)lParam; 520 533 521 int res= vboxOpenClipboard(hwnd);522 if (RT_SUCCESS(res))534 int vboxrc = vboxOpenClipboard(hwnd); 535 if (RT_SUCCESS(vboxrc)) 523 536 { 524 537 EmptyClipboard(); … … 553 566 else 554 567 { 555 LogFlowFunc(("WM_USER: Failed to open clipboard! error = %Rrc\n", res));568 LogFlowFunc(("WM_USER: Failed to open clipboard! error = %Rrc\n", vboxrc)); 556 569 } 557 570 } break; … … 563 576 HANDLE hClip = NULL; 564 577 565 int res = vboxOpenClipboard(hwnd); 566 if (RT_SUCCESS(res)) 567 { 568 int vboxrc; 578 int vboxrc = vboxOpenClipboard(hwnd); 579 if (RT_SUCCESS(vboxrc)) 580 { 569 581 if (u32Formats & VBOX_SHARED_CLIPBOARD_FMT_BITMAP) 570 582 { … … 637 649 else 638 650 { 639 LogFlowFunc(("WM_USER: Failed to open clipboard! rc: %Rrc\n", res));651 LogFlowFunc(("WM_USER: Failed to open clipboard! rc: %Rrc\n", vboxrc)); 640 652 } 641 653
Note:
See TracChangeset
for help on using the changeset viewer.