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. Exception

Exception

Scheduled Pinned Locked Moved C / C++ / MFC
8 Posts 4 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
    shir_k
    wrote on last edited by
    #1

    Hi, Why am getting this exception KERNEL32! 7c59bcb1() MSVCRTD! _CxxThrowException@8 + 57 bytes COleDispatchDriver::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 407 COleControlSite::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 976 CWnd::InvokeHelper(CWnd * const 0x0042a5a8 {CMSComm hWnd=0x00c302f0}, long 26, unsigned short 2, unsigned short 12, void * 0x053afeac) line 354 CMSComm::GetInput() line 347 + 21 bytes CNgpptDialog::SerialDataUpdate() line 613 + 15 bytes ReadResponse() line 171 KERNEL32! 7c57b3bc() Thanks

    R I 2 Replies Last reply
    0
    • S shir_k

      Hi, Why am getting this exception KERNEL32! 7c59bcb1() MSVCRTD! _CxxThrowException@8 + 57 bytes COleDispatchDriver::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 407 COleControlSite::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 976 CWnd::InvokeHelper(CWnd * const 0x0042a5a8 {CMSComm hWnd=0x00c302f0}, long 26, unsigned short 2, unsigned short 12, void * 0x053afeac) line 354 CMSComm::GetInput() line 347 + 21 bytes CNgpptDialog::SerialDataUpdate() line 613 + 15 bytes ReadResponse() line 171 KERNEL32! 7c57b3bc() Thanks

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      shir_k wrote:

      Why am getting this exception KERNEL32! 7c59bcb1() MSVCRTD! _CxxThrowException@8 + 57 bytes COleDispatchDriver::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 407 COleControlSite::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 976 CWnd::InvokeHelper(CWnd * const 0x0042a5a8 {CMSComm hWnd=0x00c302f0}, long 26, unsigned short 2, unsigned short 12, void * 0x053afeac) line 354 CMSComm::GetInput() line 347 + 21 bytes CNgpptDialog::SerialDataUpdate() line 613 + 15 bytes ReadResponse() line 171 KERNEL32! 7c57b3bc()

      Because the MSCOMM control doesn't seem to be happy with the parameters it is provided. I don't know what version of the control you're using, but since IMSComm is a published dual interface, it should not have changed. By looking at the parameters provided to CWnd::InvokeHelper() it seems like you're calling the Input method (long 26) as a DISPATCH_PROPERTYGET (unsigned short 2) and expecting a VARIANT in return (unsigned short 12). If you still want to use the MSCOMM control I suggest you declare a VARIANT and set it up prior to calling the control. Create a SAFEARRAY with SafeArrayCreate() containing an array of unsigned char (VT_UI1), let the pArray member of the VARIANT union point to the safearray and set the vt member of the VARIANT to VT_UI1 | VT_ARRAY. Look up the documentation for SafeArrayCreate() in MSDN and you'll find how to set it up. If you're willing to give the MSCOMM control up (since it's really bad in many ways) and do the serial communication yourself, which I really urge you to, you should have a look at this[^] great article.


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      S 1 Reply Last reply
      0
      • S shir_k

        Hi, Why am getting this exception KERNEL32! 7c59bcb1() MSVCRTD! _CxxThrowException@8 + 57 bytes COleDispatchDriver::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 407 COleControlSite::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 976 CWnd::InvokeHelper(CWnd * const 0x0042a5a8 {CMSComm hWnd=0x00c302f0}, long 26, unsigned short 2, unsigned short 12, void * 0x053afeac) line 354 CMSComm::GetInput() line 347 + 21 bytes CNgpptDialog::SerialDataUpdate() line 613 + 15 bytes ReadResponse() line 171 KERNEL32! 7c57b3bc() Thanks

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        Um, it might help if you said *when* you get that exception, and in what context? Does it appear on the LCD screen on your toothbrush when you use it? Is it on your toaster? Only when you try and heat poptarts? Iain.

        M S 2 Replies Last reply
        0
        • I Iain Clarke Warrior Programmer

          Um, it might help if you said *when* you get that exception, and in what context? Does it appear on the LCD screen on your toothbrush when you use it? Is it on your toaster? Only when you try and heat poptarts? Iain.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Pop-Tart exceptions are UNACCEPTABLE! :beer:

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            Um, it might help if you said *when* you get that exception, and in what context? Does it appear on the LCD screen on your toothbrush when you use it? Is it on your toaster? Only when you try and heat poptarts? Iain.

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

            Hi, Am placing the pressure data continously in CListCtrl after reading from serial port(Am reading every 10 ms with the help of timer).Am also deleting data placed in CListCtrl after displaying 150 pressure outputs on the control(am deleting only one data using m_ctrl.delete(0)) so buffer does not overflow. Flow of the program is 1) Timer interrupt occurs every 10 ms 2)Read the serial port and place it in CListCtrl at every 10 ms. This is working for some time lated above exception occurs.

            1 Reply Last reply
            0
            • R Roger Stoltz

              shir_k wrote:

              Why am getting this exception KERNEL32! 7c59bcb1() MSVCRTD! _CxxThrowException@8 + 57 bytes COleDispatchDriver::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 407 COleControlSite::InvokeHelperV(long 26, unsigned short 2, unsigned short 12, void * 0x053afeac, const unsigned char * 0x00000000, char * 0x053afe60) line 976 CWnd::InvokeHelper(CWnd * const 0x0042a5a8 {CMSComm hWnd=0x00c302f0}, long 26, unsigned short 2, unsigned short 12, void * 0x053afeac) line 354 CMSComm::GetInput() line 347 + 21 bytes CNgpptDialog::SerialDataUpdate() line 613 + 15 bytes ReadResponse() line 171 KERNEL32! 7c57b3bc()

              Because the MSCOMM control doesn't seem to be happy with the parameters it is provided. I don't know what version of the control you're using, but since IMSComm is a published dual interface, it should not have changed. By looking at the parameters provided to CWnd::InvokeHelper() it seems like you're calling the Input method (long 26) as a DISPATCH_PROPERTYGET (unsigned short 2) and expecting a VARIANT in return (unsigned short 12). If you still want to use the MSCOMM control I suggest you declare a VARIANT and set it up prior to calling the control. Create a SAFEARRAY with SafeArrayCreate() containing an array of unsigned char (VT_UI1), let the pArray member of the VARIANT union point to the safearray and set the vt member of the VARIANT to VT_UI1 | VT_ARRAY. Look up the documentation for SafeArrayCreate() in MSDN and you'll find how to set it up. If you're willing to give the MSCOMM control up (since it's really bad in many ways) and do the serial communication yourself, which I really urge you to, you should have a look at this[^] great article.


              "It's supposed to be hard, otherwise anybody could do it!" - selfquote
              "High speed never compensates for wrong direction!" - unknown

              S Offline
              S Offline
              shir_k
              wrote on last edited by
              #6

              hi, This how am getting data from serial port CString SerialData CComVariant vIn; vIn.Clear(); vIn = CMSCommPtr ->GetInput(); SerialData = vIn.bstrVal; U see any problem in the above code.

              R 1 Reply Last reply
              0
              • S shir_k

                hi, This how am getting data from serial port CString SerialData CComVariant vIn; vIn.Clear(); vIn = CMSCommPtr ->GetInput(); SerialData = vIn.bstrVal; U see any problem in the above code.

                R Offline
                R Offline
                Roger Stoltz
                wrote on last edited by
                #7

                shir_k wrote:

                CString SerialData CComVariant vIn; vIn.Clear(); vIn = CMSCommPtr ->GetInput(); SerialData = vIn.bstrVal; U see any problem in the above code.

                All COM interfaces returns a HRESULT, which is a 32-bit integer value that is an error code that equals zero if everything was OK. The ability to return any other type is disguised when using dispatch interfaces. In your case the VARIANT that is supposed to be returned is a temporary object in the wrapper for the MSComm server. The wrapper was created by the wizard when you added the ActiveX component to your project. A pointer to this temporary VARIANT is provided in the parameter list when the interface method is called. For some reason the MSComm server doesn't like how that temporary object is set up, or you may be calling it from the wrong context. This can happen if you're calling the server from a different thread than the one that created the server without marshalling the interface. I suggest that you continue with one of the following depending on whether you're using multiple threads or not: 1. If you're using multiple threads you have to know how to cross apartment boundaries the correct way. Read Lim Bio Liong's excellent articles to get the basics down. You'll find them here[^], starting with part 1. 2. If you're only using one single thread, I suggest you use the other implementation of the Input() method that takes a VARIANT in the parameter list according to my first post in this forum thread. This way you have the control over the VARIANT.


                "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                "High speed never compensates for wrong direction!" - unknown

                S 1 Reply Last reply
                0
                • R Roger Stoltz

                  shir_k wrote:

                  CString SerialData CComVariant vIn; vIn.Clear(); vIn = CMSCommPtr ->GetInput(); SerialData = vIn.bstrVal; U see any problem in the above code.

                  All COM interfaces returns a HRESULT, which is a 32-bit integer value that is an error code that equals zero if everything was OK. The ability to return any other type is disguised when using dispatch interfaces. In your case the VARIANT that is supposed to be returned is a temporary object in the wrapper for the MSComm server. The wrapper was created by the wizard when you added the ActiveX component to your project. A pointer to this temporary VARIANT is provided in the parameter list when the interface method is called. For some reason the MSComm server doesn't like how that temporary object is set up, or you may be calling it from the wrong context. This can happen if you're calling the server from a different thread than the one that created the server without marshalling the interface. I suggest that you continue with one of the following depending on whether you're using multiple threads or not: 1. If you're using multiple threads you have to know how to cross apartment boundaries the correct way. Read Lim Bio Liong's excellent articles to get the basics down. You'll find them here[^], starting with part 1. 2. If you're only using one single thread, I suggest you use the other implementation of the Input() method that takes a VARIANT in the parameter list according to my first post in this forum thread. This way you have the control over the VARIANT.


                  "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                  "High speed never compensates for wrong direction!" - unknown

                  S Offline
                  S Offline
                  shir_k
                  wrote on last edited by
                  #8

                  Ok Thanks Ours is multi threaded.I will go through the article. Our project gets hanged or crashed when i try to any multi media or graphics related file. Thanks

                  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