From: Jose de on
These were of great help to me, thanks.

Question, how do you use PostMessage(...) when working with non-window apps, (e.g. console apps as in my case?)

Does a main thread in a console have a HWND ?
From: Alex Blekhman on
<Jose de Alba> wrote:
> Question, how do you use PostMessage(...) when working with
> non-window apps, (e.g. console apps as in my case?)
>
> Does a main thread in a console have a HWND ?

If you want to use windows messages as a communication mechanism
between threads, then you can create message-only window (search
for "HWND_MESSAGE" in MSDN) in main thread and post messages to it
with `PostMessage' from working threads. You'll need to mainatin
message loop in main thread, too. On start no thread has windows
by default.

HTH
Alex


From: SvenC on
Hi Jose,

> Question, how do you use PostMessage(...) when working with
> non-window apps, (e.g. console apps as in my case?)
>
> Does a main thread in a console have a HWND ?

You do not need an HWND at all to post messages to a thread.
Just use PostThreadMessage to send and run a GetMessage loop
in the thread receiving messages.

--
SvenC