`OpenClipboard` might fail on concurrent access -- Remote Desktop Client is particularly annoying
Here is a retrying version, based on vbAccelerator code:
(Note: Make sure to call `Randomize` somewhere on process startup)Code:Public Function ClipboardOpen(ByVal hWndOwner As Long) As Boolean Dim lR As Long Dim lRetry As Long ClipboardClose For lRetry = 1 To 5 lR = OpenClipboard(hWndOwner) If lR <> 0 Then m_hWnd = hWndOwner m_bClipboardIsOpen = True '--- success ClipboardOpen = True Exit Function End If Call Sleep(Rnd() * 500) Next End Function
cheers,
</wqw>




Reply With Quote