如何从Delphi主线程向TThread发送消息? [英] How to send a message to a TThread from main thread in Delphi?

查看:806
本文介绍了如何从Delphi主线程向TThread发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向线程发送消息并在线程中处理它。在Delphi中如何做到这一点?我猜, PostMessage 是要走的路,但是我到目前为止看到的例子是描述另一种方式,即从线程到主线程。

I want to send a message to a thread and handle it in the thread. How can I do this in Delphi? I guess PostMessage is the way to go, but the examples I've seen so far are describing the other way, i.e. from the thread to main thread.

推荐答案

我甚至不会尝试解释或编写任何代码。请看本教程。这是一个有点老,但非常好的imho。
多线程 - Delphi方式

I won't even try and explain or write any code. Just look at this tutorial. It's a little old, but very good imho. Multithreading - The Delphi Way

这篇关于如何从Delphi主线程向TThread发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆