@@ -48,11 +48,12 @@ inline namespace COM
4848
4949 void VB6_Network_Protocol::OnAttach (ConstSPtr<class Network ::Client> Session)
5050 {
51+ using Declaration = void (STDAPICALLTYPE *)(CComObject<Network_Client> *);
52+
5153 if (mOnAttach )
5254 {
53- CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
54-
55- ((void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *)) mOnAttach )(& CComClient);
55+ CComObject<Network_Client> * CComClient = CCreate<Network_Client>(Session);
56+ reinterpret_cast <Declaration>(mOnAttach )(CComClient);
5657 }
5758 }
5859
@@ -61,11 +62,12 @@ inline namespace COM
6162
6263 void VB6_Network_Protocol::OnDetach (ConstSPtr<class Network ::Client> Session)
6364 {
65+ using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *);
66+
6467 if (mOnDetach )
6568 {
6669 CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
67-
68- ((void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *)) mOnDetach )(& CComClient);
70+ reinterpret_cast <Declaration>(mOnDetach )(& CComClient);
6971 }
7072 }
7173
@@ -74,12 +76,12 @@ inline namespace COM
7476
7577 void VB6_Network_Protocol::OnError (ConstSPtr<class Network ::Client> Session, UInt Error, CStr Description)
7678 {
79+ using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, vbInt32, vbStr16);
80+
7781 if (mOnError )
7882 {
7983 CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
80-
81- ((void (STDAPICALLTYPE *)(
82- CComObjectStackEx<Network_Client> *, vbInt32, vbStr16)) mOnRead )(& CComClient, Error, VBString8ToString16 (Description));
84+ reinterpret_cast <Declaration>(mOnError )(& CComClient, Error, VBString8ToString16 (Description));
8385 }
8486 }
8587
@@ -88,14 +90,13 @@ inline namespace COM
8890
8991 void VB6_Network_Protocol::OnRead (ConstSPtr<class Network ::Client> Session, CPtr<UInt08> Bytes)
9092 {
93+ using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, CComObjectStackEx<BinaryReader> *);
94+
9195 if (mOnRead )
9296 {
9397 CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
9498 CComObjectStackEx<BinaryReader> CComReader = CCreateStack<BinaryReader>(Reader (Bytes));
95-
96- ((void (STDAPICALLTYPE *)(
97- CComObjectStackEx<Network_Client> *,
98- CComObjectStackEx<BinaryReader> *)) mOnRead )(& CComClient, & CComReader);
99+ reinterpret_cast <Declaration>(mOnRead )(& CComClient, & CComReader);
99100 }
100101 }
101102
@@ -104,14 +105,13 @@ inline namespace COM
104105
105106 void VB6_Network_Protocol::OnWrite (ConstSPtr<class Network ::Client> Session, CPtr<UInt08> Bytes)
106107 {
108+ using Declaration = void (STDAPICALLTYPE *)(CComObjectStackEx<Network_Client> *, CComObjectStackEx<BinaryReader> *);
109+
107110 if (mOnWrite )
108111 {
109112 CComObjectStackEx<Network_Client> CComClient = CCreateStack<Network_Client>(Session);
110113 CComObjectStackEx<BinaryReader> CComReader = CCreateStack<BinaryReader>(Reader (Bytes));
111-
112- ((void (STDAPICALLTYPE *)(
113- CComObjectStackEx<Network_Client> *,
114- CComObjectStackEx<BinaryReader> *)) mOnWrite )(& CComClient, & CComReader);
114+ reinterpret_cast <Declaration>(mOnWrite )(& CComClient, & CComReader);
115115 }
116116 }
117117
0 commit comments