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. PostMessage() Problem in ActiveX Control from Thread

PostMessage() Problem in ActiveX Control from Thread

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestioncom
3 Posts 2 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.
  • R Offline
    R Offline
    RickGavin
    wrote on last edited by
    #1

    Hey Everyone I was working on a Browser based ActiveX Control (MFC VC++ 6 SP5) for doing file transferring. I have an internal thread in the control that handles all the transferring and such. I would like to send messages back to the main dialog for display (logging). However, I'm unable to send a message from the thread that the Control catches. I can throw messages in the control and catch them.. I can throws messages in the thread and catch them in the thread, just unable to send a message from the thread to be caught by the control (COleControl class). I have done something similar in an App, but I used an AfxGetMainWnd()->PostMessage(...) when posting the message, since this is a control and there by being a dialog based app, How do I get the message back to the main control or main dialog class? As a note, I used the "ON_REGISTERED_MESSAGE" macro to register a custom message mapping to a handler function. Is there any reason why this would cause a problem? It works in an .exe App. Thanks for any help or suggestions :confused: Rick Gavin

    P 1 Reply Last reply
    0
    • R RickGavin

      Hey Everyone I was working on a Browser based ActiveX Control (MFC VC++ 6 SP5) for doing file transferring. I have an internal thread in the control that handles all the transferring and such. I would like to send messages back to the main dialog for display (logging). However, I'm unable to send a message from the thread that the Control catches. I can throw messages in the control and catch them.. I can throws messages in the thread and catch them in the thread, just unable to send a message from the thread to be caught by the control (COleControl class). I have done something similar in an App, but I used an AfxGetMainWnd()->PostMessage(...) when posting the message, since this is a control and there by being a dialog based app, How do I get the message back to the main control or main dialog class? As a note, I used the "ON_REGISTERED_MESSAGE" macro to register a custom message mapping to a handler function. Is there any reason why this would cause a problem? It works in an .exe App. Thanks for any help or suggestions :confused: Rick Gavin

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      I am not quite sure that I follow your question, but I believe that you will want to look at the PostThreadMessage function.


      Build a man a fire, and he will be warm for a day
      Light a man on fire, and he will be warm for the rest of his life!

      R 1 Reply Last reply
      0
      • P Paul M Watt

        I am not quite sure that I follow your question, but I believe that you will want to look at the PostThreadMessage function.


        Build a man a fire, and he will be warm for a day
        Light a man on fire, and he will be warm for the rest of his life!

        R Offline
        R Offline
        RickGavin
        wrote on last edited by
        #3

        I have tried PostThreadMessage with no luck. I have an activex control, generated with the 'MFC ActiveX ControlWizard', which gives me an app class of type COleControlModule, the program is structerd as such.... The COleControl Creates the Dialog, which intern creates the Thread, which intern creates the Socket. The data from the socket needs to be displayed in the dialog. COleControlModule (App) - COleControl (Ctrl) - - CDialog - - - CWinThread - - - - CAsyncSocket How do I get a message from the CAsyncSocket derived class back to the COleControl or the CDialog? If this was an App and Not a Control, I could use AfxGetApp() or AfxGetMainWnd()->PostMessage(...) to get a handle back to the main thread. However, these reference doesn't seem to be working for me in a Control. Thanks for any help.

        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