Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to recieve a User defined messages in Win32 Console based [MFC supported] application from any other running Exe.

How to recieve a User defined messages in Win32 Console based [MFC supported] application from any other running Exe.

Scheduled Pinned Locked Moved C / C++ / MFC
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PankajB
    wrote on last edited by
    #1

    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

    P P 2 Replies Last reply
    0
    • P PankajB

      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

      P Offline
      P Offline
      PankajB
      wrote on last edited by
      #2

      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

      _ 1 Reply Last reply
      0
      • P PankajB

        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

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        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.

        P 1 Reply Last reply
        0
        • _ _Superman_

          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.

          P Offline
          P Offline
          PankajB
          wrote on last edited by
          #4

          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.

          _ 1 Reply Last reply
          0
          • P PankajB

            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.

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            Do a CreateWindow from the console application. Now you have to have a WindowProc 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.

            P 1 Reply Last reply
            0
            • _ _Superman_

              Do a CreateWindow from the console application. Now you have to have a WindowProc 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.

              P Offline
              P Offline
              PankajB
              wrote on last edited by
              #6

              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.

              _ 1 Reply Last reply
              0
              • P PankajB

                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

                P Offline
                P Offline
                Paresh Chitte
                wrote on last edited by
                #7

                Is How to send a user-defined message with SendMessage, PostMessage or PostThreadMessage[^] is helpful ? Regards, Paresh.

                P 1 Reply Last reply
                0
                • P Paresh Chitte

                  Is How to send a user-defined message with SendMessage, PostMessage or PostThreadMessage[^] is helpful ? Regards, Paresh.

                  P Offline
                  P Offline
                  PankajB
                  wrote on last edited by
                  #8

                  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

                  P 1 Reply Last reply
                  0
                  • P PankajB

                    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.

                    _ Offline
                    _ Offline
                    _Superman_
                    wrote on last edited by
                    #9

                    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.

                    1 Reply Last reply
                    0
                    • P PankajB

                      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

                      P Offline
                      P Offline
                      Paresh Chitte
                      wrote on last edited by
                      #10

                      Did you mean, your console base application is running and you want to communicate to that application ? Are you looking for something like IPC ? If Yes, Please refer more information on IPC at here[^]. Regards, Paresh.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups