I need to write a message handler in my console application that handles received messages. For example, I register WM_Test and send it by to my console application like this:
var
H: THandle;
begin
H:= FindWindow('ConsoleWindowClass', nil);
PostMessage(H, WM_Test, 0, 0);
end;
Now I want when I receive this message in my console application to show a message box.
Can I use PeekMessage or AllocateHWND in console programs?
I know that I can do this work with a pipe, but I want know whether I can do this with window message.
Yes you can. Use AllocateHWND to create a window handle. Then, you can set various properties (like the name), so you can find it using FindWindow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With