How to recieve a User defined messages in Win32 Console based [MFC supported] application from any other running Exe.
-
Hi There. Lets say, I have an exe. that sends a user defined message to my console based application on the basis of the title. Now, I have to recieve that message in my Win32 Console based application. Just FYI, MFC support is enabled in this application. Please provide your kind suggestions/pointers, so that I can proceed. Thanks. PanB
-
Hi There. Lets say, I have an exe. that sends a user defined message to my console based application on the basis of the title. Now, I have to recieve that message in my Win32 Console based application. Just FYI, MFC support is enabled in this application. Please provide your kind suggestions/pointers, so that I can proceed. Thanks. PanB
I can very easily do this by implementing WindowProc(UINT message, WPARAM wParam, LPARAM lParam) function, if the application is Dialog based or MFC Doc View based application. Another question: Can we implement WindowProc(...) in Win32 Console based application? Thanks PanB
-
I can very easily do this by implementing WindowProc(UINT message, WPARAM wParam, LPARAM lParam) function, if the application is Dialog based or MFC Doc View based application. Another question: Can we implement WindowProc(...) in Win32 Console based application? Thanks PanB
Console applications don't have message loops. You could however create a Window from a console application.
«_Superman_» I love work. It gives me something to do between weekends.
-
Console applications don't have message loops. You could however create a Window from a console application.
«_Superman_» I love work. It gives me something to do between weekends.
-
Not able to get you... I Mean, you said "You could however create a Window from a console application". Is that a solution to recieve User defined messages in Console application. If YES, then please provide pointers to impelment the same. Thanks.
Do a
CreateWindow
from the console application. Now you have to have aWindowProc
for the new window. OR You can create a thread in the console application that waits on a named event. From the other EXE you can then set the event.«_Superman_» I love work. It gives me something to do between weekends.
-
Do a
CreateWindow
from the console application. Now you have to have aWindowProc
for the new window. OR You can create a thread in the console application that waits on a named event. From the other EXE you can then set the event.«_Superman_» I love work. It gives me something to do between weekends.
Sorry Buddy. I am not very good at this. Let me share the full scenerio with you. There is an application let's say SENDER that will send a user defined message. We have another application RECIEVER, a Win32 Console application, that needs to recieve that message and on the basis of that message need to do some processing. Now, as per your suggestion, lets say I have Created a window using CreateWindow API. After this what should I do OR what am I suppose to do? In case you need any further information from my side, then please let me know. Thanks.
-
Hi There. Lets say, I have an exe. that sends a user defined message to my console based application on the basis of the title. Now, I have to recieve that message in my Win32 Console based application. Just FYI, MFC support is enabled in this application. Please provide your kind suggestions/pointers, so that I can proceed. Thanks. PanB
Is How to send a user-defined message with SendMessage, PostMessage or PostThreadMessage[^] is helpful ? Regards, Paresh.
-
Is How to send a user-defined message with SendMessage, PostMessage or PostThreadMessage[^] is helpful ? Regards, Paresh.
Thanks for your help Paresh. I know, how to send and recieve user defined messages in VC++ MFC based applications i.e., Dialog based/Doc View based application. My main problem is to recieve user defined message in Win32 console based application. Though sending messages is not a problem. Problem is only to recieve the same. Thanks
-
Sorry Buddy. I am not very good at this. Let me share the full scenerio with you. There is an application let's say SENDER that will send a user defined message. We have another application RECIEVER, a Win32 Console application, that needs to recieve that message and on the basis of that message need to do some processing. Now, as per your suggestion, lets say I have Created a window using CreateWindow API. After this what should I do OR what am I suppose to do? In case you need any further information from my side, then please let me know. Thanks.
I recommend the event mechanism rather than sending messages. Do this in the RECEIVER in a separate thread if needed.
HANDLE hEvent = CreateEvent(0, 0, 0, "MYMESSAGE");
WaitForSingleObject(hEvent, INFINITE);Do this in the SENDER
HANDLE hEvent = CreateEvent(0, 0, 0, "MYMESSAGE");
SetEvent(hEvent);«_Superman_» I love work. It gives me something to do between weekends.
-
Thanks for your help Paresh. I know, how to send and recieve user defined messages in VC++ MFC based applications i.e., Dialog based/Doc View based application. My main problem is to recieve user defined message in Win32 console based application. Though sending messages is not a problem. Problem is only to recieve the same. Thanks