Changeset 26826 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray
- Timestamp:
- Feb 26, 2010 10:51:22 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r26742 r26826 66 66 while ((format = EnumClipboardFormats (format)) != 0) 67 67 { 68 Log 68 Log(("vboxClipboardChanged: format = 0x%08X\n", format)); 69 69 switch (format) 70 70 { … … 114 114 HWND hwndNext = (HWND)lParam; 115 115 116 Log 116 Log(("vboxClipboardProcessMsg: WM_CHANGECBCHAIN: hwndRemoved %p, hwndNext %p, hwnd %p\n", hwndRemoved, hwndNext, pCtx->hwnd)); 117 117 118 118 if (hwndRemoved == pCtx->hwndNextInChain) 119 119 { 120 120 /* The window that was next to our in the chain is being removed. 121 * Relink to the new next window. 122 */ 121 * Relink to the new next window. */ 123 122 pCtx->hwndNextInChain = hwndNext; 124 123 } … … 135 134 case WM_DRAWCLIPBOARD: 136 135 { 137 Log 136 Log(("vboxClipboardProcessMsg: WM_DRAWCLIPBOARD, hwnd %p\n", pCtx->hwnd)); 138 137 139 138 if (GetClipboardOwner () != hwnd) 140 139 { 141 140 /* Clipboard was updated by another application. */ 142 vboxClipboardChanged(pCtx); /** @todo r=andy Check for return code! */141 rc = vboxClipboardChanged(pCtx); 143 142 } 144 143 145 144 /* Pass the message to next windows in the clipboard chain. */ 146 rc = SendMessage(pCtx->hwndNextInChain, msg, wParam, lParam); 145 if (RT_SUCCESS(rc)) 146 rc = SendMessage(pCtx->hwndNextInChain, msg, wParam, lParam); 147 147 } break; 148 148 … … 158 158 UINT format = (UINT)wParam; 159 159 160 Log 160 Log(("vboxClipboardProcessMsg: WM_RENDERFORMAT, format = %x\n", format)); 161 161 switch (format) 162 162 { … … 175 175 176 176 int cActual = GetClipboardFormatName(format, szFormatName, sizeof(szFormatName)/sizeof (TCHAR)); 177 178 177 if (cActual) 179 178 { … … 219 218 /* 0 bytes returned means the clipboard is empty. 220 219 * Deallocate the memory and set hMem to NULL to get to 221 * the clipboard empty code path. 222 */ 220 * the clipboard empty code path. */ 223 221 GlobalUnlock(hMem); 224 222 GlobalFree(hMem); … … 301 299 { 302 300 /* 'hMem' contains the host clipboard data. 303 * size is 'cb' and format is 'format'. 304 */ 305 HANDLE hClip = SetClipboardData (format, hMem); 301 * size is 'cb' and format is 'format'. */ 302 HANDLE hClip = SetClipboardData(format, hMem); 306 303 Log(("vboxClipboardProcessMsg: WM_RENDERFORMAT hClip = %p\n", hClip)); 307 304 … … 316 313 } 317 314 } 318 319 315 if (hMem) 320 {321 316 GlobalUnlock(hMem); 322 }323 317 } 324 325 318 if (hMem) 326 {327 319 GlobalFree(hMem); 328 }329 320 } 330 321 … … 339 330 * windows is to be destroyed and therefore the guest side becomes inactive. 340 331 */ 341 if (OpenClipboard 332 if (OpenClipboard(hwnd)) 342 333 { 343 334 EmptyClipboard(); … … 351 342 uint32_t u32Formats = (uint32_t)lParam; 352 343 353 if (FALSE == OpenClipboard (hwnd)) 354 { 355 Log(("vboxClipboardProcessMsg: WM_USER: Failed to open clipboard! Last error = %ld\n", GetLastError())); 344 if (FALSE == OpenClipboard(hwnd)) 345 { 346 DWORD dwErr = GetLastError(); 347 Log(("vboxClipboardProcessMsg: WM_USER: Failed to open clipboard! Last error = %ld\n", dwErr)); 348 rc = RTErrConvertFromWin32(dwErr); 356 349 } 357 350 else … … 392 385 /* Send data in the specified format to the host. */ 393 386 uint32_t u32Formats = (uint32_t)lParam; 394 395 387 HANDLE hClip = NULL; 396 388 397 389 if (FALSE == OpenClipboard(hwnd)) 398 390 { 391 DWORD dwErr = GetLastError(); 392 Log(("vboxClipboardProcessMsg: WM_USER + 1: Failed to open clipboard! Last error = %ld\n", dwErr)); 393 rc = RTErrConvertFromWin32(dwErr); 399 394 } 400 395 else … … 427 422 if (hClip != NULL) 428 423 { 429 LPWSTR uniString = (LPWSTR)GlobalLock 424 LPWSTR uniString = (LPWSTR)GlobalLock(hClip); 430 425 431 426 if (uniString != NULL) … … 447 442 if (format != 0) 448 443 { 449 hClip = GetClipboardData 444 hClip = GetClipboardData(format); 450 445 if (hClip != NULL) 451 446 { 452 LPVOID lp = GlobalLock 447 LPVOID lp = GlobalLock(hClip); 453 448 454 449 if (lp != NULL) … … 467 462 } 468 463 469 CloseClipboard 464 CloseClipboard(); 470 465 } 471 466 … … 479 474 default: 480 475 { 481 rc = DefWindowProc 476 rc = DefWindowProc(hwnd, msg, wParam, lParam); 482 477 } 483 478 } 484 479 480 Log(("vboxClipboardProcessMsg returned with rc = %ld\n", rc)); 485 481 return rc; 486 482 } … … 536 532 } 537 533 538 static void vboxClipboardDestroy 534 static void vboxClipboardDestroy(VBOXCLIPBOARDCONTEXT *pCtx) 539 535 { 540 536 if (pCtx->hwnd) … … 560 556 { 561 557 /* Forward with proper context. */ 562 return vboxClipboardProcessMsg 558 return vboxClipboardProcessMsg(&gCtx, hwnd, msg, wParam, lParam); 563 559 } 564 560 565 561 int VBoxClipboardInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) 566 562 { 567 Log 563 Log(("VboxClipboardInit\n")); 568 564 if (gCtx.pEnv) 569 565 { … … 590 586 } 591 587 592 if (RT_SUCCESS 588 if (RT_SUCCESS(rc)) 593 589 *ppInstance = &gCtx; 594 590 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.