Exception
-
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
-
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
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 withSafeArrayCreate()
containing an array ofunsigned char (VT_UI1)
, let the pArray member of the VARIANT union point to the safearray and set the vt member of the VARIANT toVT_UI1 | VT_ARRAY
. Look up the documentation forSafeArrayCreate()
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 -
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
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.
-
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.
Pop-Tart exceptions are UNACCEPTABLE! :beer:
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
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.
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.
-
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 withSafeArrayCreate()
containing an array ofunsigned char (VT_UI1)
, let the pArray member of the VARIANT union point to the safearray and set the vt member of the VARIANT toVT_UI1 | VT_ARRAY
. Look up the documentation forSafeArrayCreate()
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 -
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.
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 -
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