Updating VCL from the same thread that created the UI. Why?

前端 未结 3 1224
情书的邮戳
情书的邮戳 2021-02-04 16:37

I know that I must call Synchronize to update the vcl from a thread that did not create the controls or send a message to the window.

I have often heard the word not th

3条回答
  •  花落未央
    2021-02-04 16:58

    Windows controls with handles are not thread-safe (i.e. they cannot be accessed safely by two different threads at the same time), and Delphi wraps the Windows controls to give you the VCL controls. Since the controls ARE accessed by the main GUI thread, you need to leave them alone if you are executing another thread.

提交回复
热议问题