Share via

IConnectionPoint Advise 64bit

Mingyang Du 21 Reputation points
2021-12-15T08:22:51.217+00:00

Hi there,

IConnectionPoint

HRESULT Advise(
[in] IUnknown *pUnkSink,
[out] DWORD *pdwCookie
);

[out] pdwCookie
A pointer to a returned token that uniquely identifies this connection.

We're porting our 32bit application to 64bit.
For 32bit application, there's no issue for pdwCookie as DWORD.
For 64bit, DWORD is not enough for 64bit pointer.

Any suggestion for this?

Thanks in advance,
Mingyang

Windows development | Windows API - Win32

Answer accepted by question author

RLWA32 52,571 Reputation points
2021-12-15T09:00:27.047+00:00

&m_ulAdvise is passed to Advise(). For 64bit, it should not work.

This is a pointer. Assuming that m_ulAdvise is a DWORD variable then &m_ulAdvise is using the address-of operator which passes a pointer in the sample code. address-of-operator-amp

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. RLWA32 52,571 Reputation points
    2021-12-15T08:26:11.233+00:00

    You are misinterpreting the code. pdwCookie is a pointer to a DWORD. So in 64 bit code pdwCookie is a 64 bit pointer to a 32 bit value.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.