Author Topic: Why Clipboard dont work some times?  (Read 573 times)


  • New member
  • *
  • Posts: 6
Why Clipboard dont work some times?
« on: June 26, 2019, 07:03:30 pm »
I have the next code:


I had to put a sleep between parameters, otherwise the 'Paste process' sometimes doesn't work. Is there a way to avoid this problem?
(Im working on windows 10)


  • Hero Member
  • *****
  • Posts: 10586
Re: Why Clipboard dont work some times?
« Reply #1 on: June 26, 2019, 07:11:15 pm »
Windows 10 has a messaging system. You obstruct that with sleep(33). In this case use Application.ProcessMessages instead of the silly sleep, which is blocking.
You will be OK unless you access the clipboard in nano seconds..
You have to give the OS the time to process its message queue. Sleep() is not a very bright idea.... Although under Windows with one! exception: Sleep(0) has special meaning and means relinquish time slice. Any other sleep is bad programming in such a scenario, even sleep(1)....
« Last Edit: June 26, 2019, 07:19:56 pm by Thaddy »


TinyPortal © 2005-2018