1 2 // Wizard-generated connection point proxy class 3 // WARNING: This file may be regenerated by the wizard 4 5 6 #pragma once 7 8 template<class T> 9 class CProxy_IDNSSDEvents : 10 public IConnectionPointImpl<T, &__uuidof(_IDNSSDEvents)> 11 { 12 public: Fire_DomainFound(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,BSTR domain)13 HRESULT Fire_DomainFound( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, BSTR domain) 14 { 15 HRESULT hr = S_OK; 16 T * pThis = static_cast<T *>(this); 17 int cConnections = m_vec.GetSize(); 18 19 for (int iConnection = 0; iConnection < cConnections; iConnection++) 20 { 21 pThis->Lock(); 22 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 23 pThis->Unlock(); 24 25 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 26 27 if (pConnection) 28 { 29 CComVariant avarParams[4]; 30 avarParams[3] = service; 31 avarParams[2] = flags; 32 avarParams[1] = ifIndex; 33 avarParams[1].vt = VT_UI4; 34 avarParams[0] = domain; 35 avarParams[0].vt = VT_BSTR; 36 DISPPARAMS params = { avarParams, NULL, 4, 0 }; 37 hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 38 } 39 } 40 return hr; 41 } Fire_DomainLost(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,BSTR domain)42 HRESULT Fire_DomainLost( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, BSTR domain) 43 { 44 HRESULT hr = S_OK; 45 T * pThis = static_cast<T *>(this); 46 int cConnections = m_vec.GetSize(); 47 48 for (int iConnection = 0; iConnection < cConnections; iConnection++) 49 { 50 pThis->Lock(); 51 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 52 pThis->Unlock(); 53 54 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 55 56 if (pConnection) 57 { 58 CComVariant avarParams[4]; 59 avarParams[3] = service; 60 avarParams[2] = flags; 61 avarParams[1] = ifIndex; 62 avarParams[1].vt = VT_UI4; 63 avarParams[0] = domain; 64 avarParams[0].vt = VT_BSTR; 65 DISPPARAMS params = { avarParams, NULL, 4, 0 }; 66 hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 67 } 68 } 69 return hr; 70 } Fire_ServiceFound(IDNSSDService * browser,DNSSDFlags flags,ULONG ifIndex,BSTR serviceName,BSTR regType,BSTR domain)71 HRESULT Fire_ServiceFound( IDNSSDService * browser, DNSSDFlags flags, ULONG ifIndex, BSTR serviceName, BSTR regType, BSTR domain) 72 { 73 HRESULT hr = S_OK; 74 T * pThis = static_cast<T *>(this); 75 int cConnections = m_vec.GetSize(); 76 77 for (int iConnection = 0; iConnection < cConnections; iConnection++) 78 { 79 pThis->Lock(); 80 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 81 pThis->Unlock(); 82 83 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 84 85 if (pConnection) 86 { 87 CComVariant avarParams[6]; 88 avarParams[5] = browser; 89 avarParams[4] = flags; 90 avarParams[3] = ifIndex; 91 avarParams[3].vt = VT_UI4; 92 avarParams[2] = serviceName; 93 avarParams[2].vt = VT_BSTR; 94 avarParams[1] = regType; 95 avarParams[1].vt = VT_BSTR; 96 avarParams[0] = domain; 97 avarParams[0].vt = VT_BSTR; 98 DISPPARAMS params = { avarParams, NULL, 6, 0 }; 99 hr = pConnection->Invoke(3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 100 } 101 } 102 return hr; 103 } Fire_ServiceLost(IDNSSDService * browser,DNSSDFlags flags,ULONG ifIndex,BSTR serviceName,BSTR regType,BSTR domain)104 HRESULT Fire_ServiceLost( IDNSSDService * browser, DNSSDFlags flags, ULONG ifIndex, BSTR serviceName, BSTR regType, BSTR domain) 105 { 106 HRESULT hr = S_OK; 107 T * pThis = static_cast<T *>(this); 108 int cConnections = m_vec.GetSize(); 109 110 for (int iConnection = 0; iConnection < cConnections; iConnection++) 111 { 112 pThis->Lock(); 113 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 114 pThis->Unlock(); 115 116 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 117 118 if (pConnection) 119 { 120 CComVariant avarParams[6]; 121 avarParams[5] = browser; 122 avarParams[4] = flags; 123 avarParams[3] = ifIndex; 124 avarParams[3].vt = VT_UI4; 125 avarParams[2] = serviceName; 126 avarParams[2].vt = VT_BSTR; 127 avarParams[1] = regType; 128 avarParams[1].vt = VT_BSTR; 129 avarParams[0] = domain; 130 avarParams[0].vt = VT_BSTR; 131 DISPPARAMS params = { avarParams, NULL, 6, 0 }; 132 hr = pConnection->Invoke(4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 133 } 134 } 135 return hr; 136 } Fire_ServiceResolved(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,BSTR fullName,BSTR hostName,USHORT port,ITXTRecord * record)137 HRESULT Fire_ServiceResolved( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, BSTR fullName, BSTR hostName, USHORT port, ITXTRecord * record) 138 { 139 HRESULT hr = S_OK; 140 T * pThis = static_cast<T *>(this); 141 int cConnections = m_vec.GetSize(); 142 143 for (int iConnection = 0; iConnection < cConnections; iConnection++) 144 { 145 pThis->Lock(); 146 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 147 pThis->Unlock(); 148 149 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 150 151 if (pConnection) 152 { 153 CComVariant avarParams[7]; 154 avarParams[6] = service; 155 avarParams[5] = flags; 156 avarParams[4] = ifIndex; 157 avarParams[4].vt = VT_UI4; 158 avarParams[3] = fullName; 159 avarParams[3].vt = VT_BSTR; 160 avarParams[2] = hostName; 161 avarParams[2].vt = VT_BSTR; 162 avarParams[1] = port; 163 avarParams[1].vt = VT_UI2; 164 avarParams[0] = record; 165 DISPPARAMS params = { avarParams, NULL, 7, 0 }; 166 hr = pConnection->Invoke(5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 167 } 168 } 169 return hr; 170 } Fire_ServiceRegistered(IDNSSDService * service,DNSSDFlags flags,BSTR name,BSTR regType,BSTR domain)171 HRESULT Fire_ServiceRegistered( IDNSSDService * service, DNSSDFlags flags, BSTR name, BSTR regType, BSTR domain) 172 { 173 HRESULT hr = S_OK; 174 T * pThis = static_cast<T *>(this); 175 int cConnections = m_vec.GetSize(); 176 177 for (int iConnection = 0; iConnection < cConnections; iConnection++) 178 { 179 pThis->Lock(); 180 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 181 pThis->Unlock(); 182 183 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 184 185 if (pConnection) 186 { 187 CComVariant avarParams[5]; 188 avarParams[4] = service; 189 avarParams[3] = flags; 190 avarParams[2] = name; 191 avarParams[2].vt = VT_BSTR; 192 avarParams[1] = regType; 193 avarParams[1].vt = VT_BSTR; 194 avarParams[0] = domain; 195 avarParams[0].vt = VT_BSTR; 196 DISPPARAMS params = { avarParams, NULL, 5, 0 }; 197 hr = pConnection->Invoke(6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 198 } 199 } 200 return hr; 201 } Fire_QueryRecordAnswered(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,BSTR fullName,DNSSDRRType rrtype,DNSSDRRClass rrclass,VARIANT rdata,ULONG ttl)202 HRESULT Fire_QueryRecordAnswered( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, BSTR fullName, DNSSDRRType rrtype, DNSSDRRClass rrclass, VARIANT rdata, ULONG ttl) 203 { 204 HRESULT hr = S_OK; 205 T * pThis = static_cast<T *>(this); 206 int cConnections = m_vec.GetSize(); 207 208 for (int iConnection = 0; iConnection < cConnections; iConnection++) 209 { 210 pThis->Lock(); 211 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 212 pThis->Unlock(); 213 214 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 215 216 if (pConnection) 217 { 218 CComVariant avarParams[8]; 219 avarParams[7] = service; 220 avarParams[6] = flags; 221 avarParams[5] = ifIndex; 222 avarParams[5].vt = VT_UI4; 223 avarParams[4] = fullName; 224 avarParams[4].vt = VT_BSTR; 225 avarParams[3] = rrtype; 226 avarParams[2] = rrclass; 227 avarParams[1] = rdata; 228 avarParams[0] = ttl; 229 avarParams[0].vt = VT_UI4; 230 DISPPARAMS params = { avarParams, NULL, 8, 0 }; 231 hr = pConnection->Invoke(7, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 232 } 233 } 234 return hr; 235 } Fire_RecordRegistered(IDNSSDRecord * record,DNSSDFlags flags)236 HRESULT Fire_RecordRegistered( IDNSSDRecord * record, DNSSDFlags flags) 237 { 238 HRESULT hr = S_OK; 239 T * pThis = static_cast<T *>(this); 240 int cConnections = m_vec.GetSize(); 241 242 for (int iConnection = 0; iConnection < cConnections; iConnection++) 243 { 244 pThis->Lock(); 245 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 246 pThis->Unlock(); 247 248 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 249 250 if (pConnection) 251 { 252 CComVariant avarParams[2]; 253 avarParams[1] = record; 254 avarParams[0] = flags; 255 DISPPARAMS params = { avarParams, NULL, 2, 0 }; 256 hr = pConnection->Invoke(8, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 257 } 258 } 259 return hr; 260 } Fire_AddressFound(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,BSTR hostname,DNSSDAddressFamily addressFamily,BSTR address,ULONG ttl)261 HRESULT Fire_AddressFound( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, BSTR hostname, DNSSDAddressFamily addressFamily, BSTR address, ULONG ttl) 262 { 263 HRESULT hr = S_OK; 264 T * pThis = static_cast<T *>(this); 265 int cConnections = m_vec.GetSize(); 266 267 for (int iConnection = 0; iConnection < cConnections; iConnection++) 268 { 269 pThis->Lock(); 270 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 271 pThis->Unlock(); 272 273 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 274 275 if (pConnection) 276 { 277 CComVariant avarParams[7]; 278 avarParams[6] = service; 279 avarParams[5] = flags; 280 avarParams[4] = ifIndex; 281 avarParams[4].vt = VT_UI4; 282 avarParams[3] = hostname; 283 avarParams[3].vt = VT_BSTR; 284 avarParams[2] = addressFamily; 285 avarParams[1] = address; 286 avarParams[1].vt = VT_BSTR; 287 avarParams[0] = ttl; 288 avarParams[0].vt = VT_UI4; 289 DISPPARAMS params = { avarParams, NULL, 7, 0 }; 290 hr = pConnection->Invoke(9, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 291 } 292 } 293 return hr; 294 } Fire_MappingCreated(IDNSSDService * service,DNSSDFlags flags,ULONG ifIndex,ULONG externalAddress,DNSSDAddressFamily addressFamily,DNSSDProtocol protocol,USHORT internalPort,USHORT externalPort,ULONG ttl)295 HRESULT Fire_MappingCreated( IDNSSDService * service, DNSSDFlags flags, ULONG ifIndex, ULONG externalAddress, DNSSDAddressFamily addressFamily, DNSSDProtocol protocol, USHORT internalPort, USHORT externalPort, ULONG ttl) 296 { 297 HRESULT hr = S_OK; 298 T * pThis = static_cast<T *>(this); 299 int cConnections = m_vec.GetSize(); 300 301 for (int iConnection = 0; iConnection < cConnections; iConnection++) 302 { 303 pThis->Lock(); 304 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 305 pThis->Unlock(); 306 307 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 308 309 if (pConnection) 310 { 311 CComVariant avarParams[9]; 312 avarParams[8] = service; 313 avarParams[7] = flags; 314 avarParams[6] = ifIndex; 315 avarParams[6].vt = VT_UI4; 316 avarParams[5] = externalAddress; 317 avarParams[5].vt = VT_UI4; 318 avarParams[4] = addressFamily; 319 avarParams[3] = protocol; 320 avarParams[2] = internalPort; 321 avarParams[2].vt = VT_UI2; 322 avarParams[1] = externalPort; 323 avarParams[1].vt = VT_UI2; 324 avarParams[0] = ttl; 325 avarParams[0].vt = VT_UI4; 326 DISPPARAMS params = { avarParams, NULL, 9, 0 }; 327 hr = pConnection->Invoke(10, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 328 } 329 } 330 return hr; 331 } Fire_OperationFailed(IDNSSDService * service,DNSSDError error)332 HRESULT Fire_OperationFailed( IDNSSDService * service, DNSSDError error) 333 { 334 HRESULT hr = S_OK; 335 T * pThis = static_cast<T *>(this); 336 int cConnections = m_vec.GetSize(); 337 338 for (int iConnection = 0; iConnection < cConnections; iConnection++) 339 { 340 pThis->Lock(); 341 CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection); 342 pThis->Unlock(); 343 344 IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p); 345 346 if (pConnection) 347 { 348 CComVariant avarParams[2]; 349 avarParams[1] = service; 350 avarParams[0] = error; 351 DISPPARAMS params = { avarParams, NULL, 2, 0 }; 352 hr = pConnection->Invoke(11, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 353 } 354 } 355 return hr; 356 } 357 }; 358 359