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. COM
  4. How to make ActiveX Control Redraw in a work thread?

How to make ActiveX Control Redraw in a work thread?

Scheduled Pinned Locked Moved COM
comtutorialquestion
4 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.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    I wrote an ActiveX Control, I hope it can show different picture every 10 seconds. So I start a work thread, it prepairs the picture's data and calls the control's FireViewChange method every 10 seconds. Now it seems like that FireViewChange call does not work because the picture that control shows out won't change until I resize the test web page. My control is apartment thread mode and I call CoInitialize(NULL) in my work thread. What changes should I do to make my control work as I want? Thank you.:confused:

    L 1 Reply Last reply
    0
    • S samfromcn

      I wrote an ActiveX Control, I hope it can show different picture every 10 seconds. So I start a work thread, it prepairs the picture's data and calls the control's FireViewChange method every 10 seconds. Now it seems like that FireViewChange call does not work because the picture that control shows out won't change until I resize the test web page. My control is apartment thread mode and I call CoInitialize(NULL) in my work thread. What changes should I do to make my control work as I want? Thank you.:confused:

      L Offline
      L Offline
      Lim Bio Liong
      wrote on last edited by
      #2

      Hello samfromcn, It is possible that you have not marshalled the ActiveX's event interface (which contains the FireViewChange() method) to your worker thread. - Bio.

      S 1 Reply Last reply
      0
      • L Lim Bio Liong

        Hello samfromcn, It is possible that you have not marshalled the ActiveX's event interface (which contains the FireViewChange() method) to your worker thread. - Bio.

        S Offline
        S Offline
        samfromcn
        wrote on last edited by
        #3

        Thank Bio, Someone said that FireViewChange interact with the container, then the container tells the control to redraw. It's a little complicated for me. Now I create a hide window in main thread, work thread send user message to the window, the window call control's FireViewChange. This is easy to implement and it works well^_^. :-D

        L 1 Reply Last reply
        0
        • S samfromcn

          Thank Bio, Someone said that FireViewChange interact with the container, then the container tells the control to redraw. It's a little complicated for me. Now I create a hide window in main thread, work thread send user message to the window, the window call control's FireViewChange. This is easy to implement and it works well^_^. :-D

          L Offline
          L Offline
          Lim Bio Liong
          wrote on last edited by
          #4

          Hello samfromcn, >> Someone said that FireViewChange interact with the container... Yes, the "container" is actually what we know of as the "apartment". It is a good analogy. >> Now I create a hide window in main thread, work thread send user message to the window, the window call control's FireViewChange... This will certainly work. It also works similarly to the actual industrial practice of firing an event from across a separate thread via a proxy to the event interface of the ActiveX marshalled in from the main thread. However, samfromcn, it is better to learn event interface marsalling in the long run. Best of luck, - Bio.

          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