I would like to send / receive a string from 2 CONSOLE Applications (2 different PIDs with no Forms!). I saw that I need the declare this in a class. Is it possible to do this without having a class at all in a console application? If so, how I can do that?
Thanks for your help.
You can’t use
WM_COPYDATAwithout a window to send it to. If you don’t use classes, you will have to use the Win32 APIRegisterClass()andCreateWindow/Ex()functions directly to allocate a window and provide your own stand-alone function for its message handler procedure.But why not use classes? Then you can leverage the RTL’s built-in message handler systems. At the very least, you can use
AllocateHWnd()with a static class method so you don’t have to instantiate a class object at runtime, eg:If this does not suit your needs, then you should consider a different IPC mechanism that does not rely on windows, such as named pipes, mailslots, sockets, etc.