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. IHTMLElement & put_innerHTML update problem

IHTMLElement & put_innerHTML update problem

Scheduled Pinned Locked Moved COM
helpannouncement
12 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.
  • N Neville Franks

    Ceri wrote: Does anyone know a problem to this solution. :-D Where is the MSHTML Com Object. Is it an app of yours or are you doing something in IE? A code snippet might help. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

    C Offline
    C Offline
    Ceri
    wrote on last edited by
    #3

    It's a C++ MFC app that I am developing in. Basicly the loop snippet looks something like this; pElem is a pointer to an IHTMLElement iProg is an integer that contains a progress bsText is a formated BSTR that contains the string to put in the innerHTML [code] do { iProg = GetCurrentProgress(); ... //string formating to put number into BSTR. e.g. "10%" pElem->put_innerHTML(bsText); }while(iProg != 100) [/code] The code works except that the display only updates when I move the mouse over the embedded IE control

    N 1 Reply Last reply
    0
    • C Ceri

      It's a C++ MFC app that I am developing in. Basicly the loop snippet looks something like this; pElem is a pointer to an IHTMLElement iProg is an integer that contains a progress bsText is a formated BSTR that contains the string to put in the innerHTML [code] do { iProg = GetCurrentProgress(); ... //string formating to put number into BSTR. e.g. "10%" pElem->put_innerHTML(bsText); }while(iProg != 100) [/code] The code works except that the display only updates when I move the mouse over the embedded IE control

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #4

      Sitting in a tight light probably isn't a good idea. Try calling UpdateWindow() on the View. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

      S C 2 Replies Last reply
      0
      • N Neville Franks

        Sitting in a tight light probably isn't a good idea. Try calling UpdateWindow() on the View. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

        S Offline
        S Offline
        Steve S
        wrote on last edited by
        #5

        Neville Franks wrote: tight light Err, did you mean tight loop? Steve S

        N 1 Reply Last reply
        0
        • S Steve S

          Neville Franks wrote: tight light Err, did you mean tight loop? Steve S

          N Offline
          N Offline
          Neville Franks
          wrote on last edited by
          #6

          Steve S wrote: Err, did you mean tight loop? Maybe I was thinking he needs to see the light, or that I need to turn the light out and head for bed, seeing its nearly 11pm here and I started coding at 5am.:zzz: Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

          1 Reply Last reply
          0
          • N Neville Franks

            Sitting in a tight light probably isn't a good idea. Try calling UpdateWindow() on the View. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

            C Offline
            C Offline
            Ceri
            wrote on last edited by
            #7

            Hi, Yes i already tried that and it didn't work. If you think that being in a tight loop will be a problem how else could you do something that needed to be updated often. Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop. Ceri

            N 1 Reply Last reply
            0
            • C Ceri

              Hi, Yes i already tried that and it didn't work. If you think that being in a tight loop will be a problem how else could you do something that needed to be updated often. Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop. Ceri

              N Offline
              N Offline
              Neville Franks
              wrote on last edited by
              #8

              Ceri wrote: Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop. There are various problems doing GUI stuff from secondary threads with MFC. I would try doing the updates from the main thread. In the secondary thread Post a message to the main thread and add a Message handler and get it to do the work of updating IE. That should fix it. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

              C 2 Replies Last reply
              0
              • N Neville Franks

                Ceri wrote: Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop. There are various problems doing GUI stuff from secondary threads with MFC. I would try doing the updates from the main thread. In the secondary thread Post a message to the main thread and add a Message handler and get it to do the work of updating IE. That should fix it. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

                C Offline
                C Offline
                Ceri
                wrote on last edited by
                #9

                I will try that. Another thing that I have noticed though is that it does update the first 5 or 6 times but then after that it doesnt. No matter what the update rate is 1 a second or 10 times a second it only updated 5 - 6 times.

                1 Reply Last reply
                0
                • N Neville Franks

                  Ceri wrote: Another thing that i forgot to mention is that this happenes in a different thread than the IE Windows message loop. There are various problems doing GUI stuff from secondary threads with MFC. I would try doing the updates from the main thread. In the secondary thread Post a message to the main thread and add a Message handler and get it to do the work of updating IE. That should fix it. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

                  C Offline
                  C Offline
                  Ceri
                  wrote on last edited by
                  #10

                  Done a postmessage with a custom message and it worked fine. Thanks. I think that is a bit silly mind, I think that the message loop is a little slow. Although it's OK in this case. Ceri

                  N 1 Reply Last reply
                  0
                  • C Ceri

                    Done a postmessage with a custom message and it worked fine. Thanks. I think that is a bit silly mind, I think that the message loop is a little slow. Although it's OK in this case. Ceri

                    N Offline
                    N Offline
                    Neville Franks
                    wrote on last edited by
                    #11

                    Ceri wrote: Done a postmessage with a custom message and it worked fine. Thanks. I thought it would.;) Ceri wrote: I think that the message loop is a little slow I haven't noticed any problems doing this in ED (see sig) which is heavilly multithreaded. But I haven't tried updating the HTML control this way. You might want to through in an UpdateWindow(). Or maybe your tight loop is using too much CPU. ;) Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

                    C 1 Reply Last reply
                    0
                    • N Neville Franks

                      Ceri wrote: Done a postmessage with a custom message and it worked fine. Thanks. I thought it would.;) Ceri wrote: I think that the message loop is a little slow I haven't noticed any problems doing this in ED (see sig) which is heavilly multithreaded. But I haven't tried updating the HTML control this way. You might want to through in an UpdateWindow(). Or maybe your tight loop is using too much CPU. ;) Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

                      C Offline
                      C Offline
                      Ceri
                      wrote on last edited by
                      #12

                      Tried the UpdateWindow and I also but a Sleep up to 1000ms and it still only updated 5 times then stoped unless I moved the mouse. Oh well who cares, it works now. Thanks for your 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