__raise throws exception 
Author Message
 __raise throws exception

Hi;

When try to raise an event, gets error with following codes;

[
 event_source(native)
]
class CChMIBTreeCtrl : public CTreeCtrl
{
 DECLARE_DYNCREATE(CChMIBTreeCtrl)

 __event void MyEvent();
.
.
.

Quote:
};

.
.
.

void CChMIBTreeCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
 try
 {
  __raise MyEvent();
 }
 catch (...)
 {
 }

Quote:
}

Why ?.... Anybody will help ?

Thx.
--
Devinim T?LEN

IS Technology Services Manager

Global Bilgi Paz., Dan. ve ?aery Servisi Hiz. A.T.

Fatih C. Dereboyu S. No:8 34660  Halkaly-Ystanbul/Trkiye

GSM : +90 (532) 555 5500
Tel : +90 (212) 473 2020
Fax : +90 (533) 981 4683



Sat, 23 Apr 2005 00:01:54 GMT  
 __raise throws exception
hi, i had the same problem.

The reason is non-zero initialization of the event-data
structurs ( strange Bug! ).
I solved it with a workaround.
Knowing that the event-data is 'behind' the last explizit
data member,
do this in every constructor:

{
size_t cSize = offsetof( class CMyClass, m_last );
cSize += sizeof( m_last );
memset( ((char*)this) + cSize, 0, sizeof( class MyClass ) -
 cSize );

Quote:
>-----Original Message-----
>Hi;

>When try to raise an event, gets error with following
codes;

>[
> event_source(native)
>]
>class CChMIBTreeCtrl : public CTreeCtrl
>{
> DECLARE_DYNCREATE(CChMIBTreeCtrl)

> __event void MyEvent();
>..
>..
>..
>};

>..
>..
>..

>void CChMIBTreeCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT
*pResult)
>{
> try
> {
>  __raise MyEvent();
> }
> catch (...)
> {
> }
>}

>Why ?.... Anybody will help ?

>Thx.
>--
>Devinim T?LEN

>IS Technology Services Manager

>Global Bilgi Paz., Dan. ve ?aery Servisi Hiz. A.T.

>Fatih C. Dereboyu S. No:8 34660  Halkaly-Ystanbul/Trkiye

>GSM : +90 (532) 555 5500
>Tel : +90 (212) 473 2020
>Fax : +90 (533) 981 4683

>.



Mon, 25 Apr 2005 23:41:37 GMT  
 __raise throws exception


hi, i had the same problem.

The reason is non-zero initialization of the event-data
structurs ( strange Bug! ).
I solved it with a workaround.
Knowing that the event-data is 'behind' the last explizit
data member,
do this in every constructor:

{
size_t cSize = offsetof( class CMyClass, m_last );
cSize += sizeof( m_last );
memset( ((char*)this) + cSize, 0, sizeof( class MyClass ) -
 cSize );

Is the last data member the last non-static member that is declared in the
class definition ?

Quote:
>-----Original Message-----
>Hi;

>When try to raise an event, gets error with following
codes;

>[
> event_source(native)
>]
>class CChMIBTreeCtrl : public CTreeCtrl
>{
> DECLARE_DYNCREATE(CChMIBTreeCtrl)

> __event void MyEvent();
>..
>..
>..
>};

>..
>..
>..

>void CChMIBTreeCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT
*pResult)
>{
> try
> {
>  __raise MyEvent();
> }
> catch (...)
> {
> }
>}

>Why ?.... Anybody will help ?

>Thx.
>--
>Devinim T?LEN

>IS Technology Services Manager

>Global Bilgi Paz., Dan. ve ?aery Servisi Hiz. A.T.

>Fatih C. Dereboyu S. No:8 34660  Halkaly-Ystanbul/Trkiye

>GSM : +90 (532) 555 5500
>Tel : +90 (212) 473 2020
>Fax : +90 (533) 981 4683

>.



Tue, 26 Apr 2005 01:34:35 GMT  
 __raise throws exception
Hi Andy;

Thanks for all, it works... :)))



hi, i had the same problem.

The reason is non-zero initialization of the event-data
structurs ( strange Bug! ).
I solved it with a workaround.
Knowing that the event-data is 'behind' the last explizit
data member,
do this in every constructor:

{
size_t cSize = offsetof( class CMyClass, m_last );
cSize += sizeof( m_last );
memset( ((char*)this) + cSize, 0, sizeof( class MyClass ) -
 cSize );

Quote:
>-----Original Message-----
>Hi;

>When try to raise an event, gets error with following
codes;

>[
> event_source(native)
>]
>class CChMIBTreeCtrl : public CTreeCtrl
>{
> DECLARE_DYNCREATE(CChMIBTreeCtrl)

> __event void MyEvent();
>..
>..
>..
>};

>..
>..
>..

>void CChMIBTreeCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT
*pResult)
>{
> try
> {
>  __raise MyEvent();
> }
> catch (...)
> {
> }
>}

>Why ?.... Anybody will help ?

>Thx.
>--
>Devinim T?LEN

>IS Technology Services Manager

>Global Bilgi Paz., Dan. ve ?aery Servisi Hiz. A.T.

>Fatih C. Dereboyu S. No:8 34660  Halkaly-Ystanbul/Trkiye

>GSM : +90 (532) 555 5500
>Tel : +90 (212) 473 2020
>Fax : +90 (533) 981 4683

>.



Wed, 27 Apr 2005 03:36:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. attributes, __raise throwing exception.

2. NullReferenceException thrown when raising an event where there are no event handlers attached

3. Exception handling - how to know which exceptions are thrown

4. Help: Setting a cooking is raising a exception error

5. interface inheritance raises exception while referring hte COM dll in .NET

6. Raise exception from one thread to another thread

7. How to raise exception in ATL COM?

8. OLEChange VT_BSTR to VT_BSTRT - raises exception

9. How can I raise exception inside ATL object

10. CRecordSet::AddNew raise exception.

11. delete operation is raising exception in VC 5.0 debugger envoironment

12. Raising 'Index out of Bound' Exception

 

 
Powered by phpBB® Forum Software