Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Outlook 2007: Problem with SinkEvents on first explorer

Geek News

Outlook 2007: Problem with SinkEvents on first explorer
"news.microsoft.com" <scott_quinn[ at ]hotmail.com> 6/7/2006 10:34:23 AM
This is a multi-part message in MIME format.

------=_NextPart_000_0011_01C68A71.C3338970
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I'm having trouble sinking events on the initial Outlook explorer with =
the OL 2007 Beta.

I get an exception (access violation) on this queryinterface call in my =
explorer event handler when I try to sink events.

hr =3D m_pExplorer->QueryInterface(IID_IConnectionPointContainer, =
(void **)&pCPC); =20
=20
m_pExplorer is an Outlook::_ExplorerPtr =20

Here's the code in context .....
void CExplorerHandler::SinkEvents()
{
HRESULT hr;

IConnectionPointContainer* pCPC;
hr =3D m_pExplorer->QueryInterface(IID_IConnectionPointContainer, =
(void **)&pCPC); =20
if (SUCCEEDED(hr))
{
hr =3D =
pCPC->FindConnectionPoint(__uuidof(Outlook::ExplorerEvents), =
&m_pConnection);
if (SUCCEEDED(hr))
{
AddRef();=20

hr =3D =
m_pConnection->Advise(static_cast<IDispatch*>(this), &m_dwCookie);
}

<----- SNIP ---->
Now this used to work just fine on OL2003 (and OLXP and OL2000) and also =
works on any additional explorers opened in Outlook 2007.=20

It just seems to be the 1st one that causes the problem.

Any ideas ? ....... A security issue ? A Microsoft bug ? Something about =
the timing of the Outlook startup has changed ?

Regards,

Scott Quinn


------=_NextPart_000_0011_01C68A71.C3338970
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm having trouble sinking events on =
the initial=20
Outlook explorer with the OL 2007 Beta.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get an exception (access =
violation) on this=20
queryinterface call in my explorer event handler when I try to sink=20
events.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>    hr =3D=20
m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void=20
**)&pCPC);   <BR>    </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>m_pExplorer is an  <A=20
href=3D"outlook::_ExplorerPtr">Outlook::_ExplorerPtr</A>   =
;</FONT><FONT=20
face=3DArial size=3D2></DIV></FONT>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT>
<DIV><FONT face=3DArial size=3D2>Here's the code in context =
......</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>void=20
CExplorerHandler::SinkEvents()<BR>{<BR>    HRESULT=20
hr;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>    =
IConnectionPointContainer*=20
pCPC;<BR><STRONG>    hr =3D=20
m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void=20
**)&pCPC);</STRONG>   <BR>    if=20
(SUCCEEDED(hr))<BR>    {<BR>   =20
    hr =3D =
pCPC->FindConnectionPoint(__uuidof(</FONT><A=20
href=3D"outlook::ExplorerEvents"><FONT face=3DArial=20
size=3D2>Outlook::ExplorerEvents</FONT></A><FONT face=3DArial =
size=3D2>),=20
&m_pConnection);<BR>        if=20
(SUCCEEDED(hr))</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>        =

{<BR>            =
AddRef();=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>        =

    hr =3D=20
m_pConnection->Advise(static_cast<IDispatch*>(this),=20
&m_dwCookie);<BR>        =
}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>    <----- SNIP=20
----></FONT></DIV></BLOCKQUOTE>
<DIV><FONT face=3DArial size=3D2>Now this <U>used to work just fine</U> =
on OL2003=20
(and OLXP and OL2000) and </FONT><FONT face=3DArial size=3D2>also =
<U>works on any=20
additional explorers opened in Outlook 2007</U>. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>It just seems to be the 1st one that =
causes the=20
problem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Any ideas ? ....... </FONT><FONT =
face=3DArial=20
size=3D2>A security issue ? A Microsoft bug ? Something about the timing =
of the=20
Outlook startup has changed ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Scott Quinn</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>

------=_NextPart_000_0011_01C68A71.C3338970--

Re: Outlook 2007: Problem with SinkEvents on first explorer
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 6/7/2006 4:51:32 PM
An obvious question: are you sure m_pExplorer is not NULL?
When do you make that call?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"news.microsoft.com" <scott_quinn[ at ]hotmail.com> wrote in message
news:uurpZ4hiGHA.4284[ at ]TK2MSFTNGP05.phx.gbl...
Hi,

I'm having trouble sinking events on the initial Outlook explorer with the
OL 2007 Beta.

I get an exception (access violation) on this queryinterface call in my
explorer event handler when I try to sink events.

hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
**)&pCPC);

m_pExplorer is an Outlook::_ExplorerPtr

Here's the code in context .....
void CExplorerHandler::SinkEvents()
{
HRESULT hr;

IConnectionPointContainer* pCPC;
hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
**)&pCPC);
if (SUCCEEDED(hr))
{
hr = pCPC->FindConnectionPoint(__uuidof(Outlook::ExplorerEvents),
&m_pConnection);
if (SUCCEEDED(hr))
{
AddRef();

hr = m_pConnection->Advise(static_cast<IDispatch*>(this),
&m_dwCookie);
}

<----- SNIP ---->
Now this used to work just fine on OL2003 (and OLXP and OL2000) and also
works on any additional explorers opened in Outlook 2007.

It just seems to be the 1st one that causes the problem.

Any ideas ? ....... A security issue ? A Microsoft bug ? Something about the
timing of the Outlook startup has changed ?

Regards,

Scott Quinn


Re: Outlook 2007: Problem with SinkEvents on first explorer
"Scott Quinn" <scott_quinn[ at ]hotmail.com> 6/8/2006 12:39:44 AM
Hi Dmitry,

No .... the pointer is not NULL.

I get the pointer from the app by calling ActiveExplorer (and I get the same
pointer getting the first item from the explorers collection).

The call itself is initially made in raw_OnStartupComplete (while at the
same time I successfully sink events on the explorers and inspectors
collections).

The application continues to try sink events on the main explorer itself
later (called by a timer).... but still without any luck..

Scott

"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> wrote in message
news:#kC3IJliGHA.836[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text]
> An obvious question: are you sure m_pExplorer is not NULL?
> When do you make that call?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "news.microsoft.com" <scott_quinn[ at ]hotmail.com> wrote in message
> news:uurpZ4hiGHA.4284[ at ]TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I'm having trouble sinking events on the initial Outlook explorer with the
> OL 2007 Beta.
>
> I get an exception (access violation) on this queryinterface all in my
> explorer event handler when I try to sink events.
>
> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
> **)&pCPC);
>
> m_pExplorer is an Outlook::_ExplorerPtr
>
> Here's the code in context .....
> void CExplorerHandler::SinkEvents()
> {
> HRESULT hr;
>
> IConnectionPointContainer* pCPC;
> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
> **)&pCPC);
> if (SUCCEEDED(hr))
> {
> hr = pCPC->FindConnectionPoint(__uuidof(Outlook::ExplorerEvents),
> &m_pConnection);
> if (SUCCEEDED(hr))
> {
> AddRef();
>
> hr = m_pConnection->Advise(static_cast<IDispatch*>(this),
> &m_dwCookie);
> }
>
> <----- SNIP ---->
> Now this used to work just fine on OL2003 (and OLXP and OL2000) and also
> works on any additional explorers opened in Outlook 2007.
>
> It just seems to be the 1st one that causes the problem.
>
> Any ideas ? ....... A security issue ? A Microsoft bug ? Something about
the
> timing of the Outlook startup has changed ?
>
> Regards,
>
> Scott Quinn
>
>


Re: Outlook 2007: Problem with SinkEvents on first explorer
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 6/8/2006 4:47:37 PM
Hmmm... Does QI fail for other interfaces, such as IDispatch or IOleWindow?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Scott Quinn" <scott_quinn[ at ]hotmail.com> wrote in message
news:Ou5txQpiGHA.4776[ at ]TK2MSFTNGP05.phx.gbl...
[Quoted Text]
> Hi Dmitry,
>
> No .... the pointer is not NULL.
>
> I get the pointer from the app by calling ActiveExplorer (and I get the
> same
> pointer getting the first item from the explorers collection).
>
> The call itself is initially made in raw_OnStartupComplete (while at the
> same time I successfully sink events on the explorers and inspectors
> collections).
>
> The application continues to try sink events on the main explorer itself
> later (called by a timer).... but still without any luck..
>
> Scott
>
> "Dmitry Streblechenko" <dmitry[ at ]dimastr.com> wrote in message
> news:#kC3IJliGHA.836[ at ]TK2MSFTNGP02.phx.gbl...
>> An obvious question: are you sure m_pExplorer is not NULL?
>> When do you make that call?
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "news.microsoft.com" <scott_quinn[ at ]hotmail.com> wrote in message
>> news:uurpZ4hiGHA.4284[ at ]TK2MSFTNGP05.phx.gbl...
>> Hi,
>>
>> I'm having trouble sinking events on the initial Outlook explorer with
>> the
>> OL 2007 Beta.
>>
>> I get an exception (access violation) on this queryinterface all in my
>> explorer event handler when I try to sink events.
>>
>> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
>> **)&pCPC);
>>
>> m_pExplorer is an Outlook::_ExplorerPtr
>>
>> Here's the code in context .....
>> void CExplorerHandler::SinkEvents()
>> {
>> HRESULT hr;
>>
>> IConnectionPointContainer* pCPC;
>> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer, (void
>> **)&pCPC);
>> if (SUCCEEDED(hr))
>> {
>> hr = pCPC->FindConnectionPoint(__uuidof(Outlook::ExplorerEvents),
>> &m_pConnection);
>> if (SUCCEEDED(hr))
>> {
>> AddRef();
>>
>> hr = m_pConnection->Advise(static_cast<IDispatch*>(this),
>> &m_dwCookie);
>> }
>>
>> <----- SNIP ---->
>> Now this used to work just fine on OL2003 (and OLXP and OL2000) and also
>> works on any additional explorers opened in Outlook 2007.
>>
>> It just seems to be the 1st one that causes the problem.
>>
>> Any ideas ? ....... A security issue ? A Microsoft bug ? Something about
> the
>> timing of the Outlook startup has changed ?
>>
>> Regards,
>>
>> Scott Quinn
>>
>>
>
>


Re: Outlook 2007: Problem with SinkEvents on first explorer
"Scott Quinn" <scott_quinn[ at ]hotmail.com> 6/9/2006 7:46:28 AM
Good point Dmitry and yeah they were exception fodder too.

Anyway I have a solution.....

While the pointer from ActiveExplorer() appears to be a valid pointer and
some methods seem work (AddRef) for the most part it's stuffed.

If I get a pointer from the explorers collection all works fine.

So there may be a bug in OL2007 with the object model and ActiveExplorer()

Thanks,

Scott Quinn

"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> wrote in message
news:#VyMnrxiGHA.1936[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Hmmm... Does QI fail for other interfaces, such as IDispatch or
IOleWindow?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Scott Quinn" <scott_quinn[ at ]hotmail.com> wrote in message
> news:Ou5txQpiGHA.4776[ at ]TK2MSFTNGP05.phx.gbl...
> > Hi Dmitry,
> >
> > No .... the pointer is not NULL.
> >
> > I get the pointer from the app by calling ActiveExplorer (and I get the
> > same
> > pointer getting the first item from the explorers collection).
> >
> > The call itself is initially made in raw_OnStartupComplete (while at the
> > same time I successfully sink events on the explorers and inspectors
> > collections).
> >
> > The application continues to try sink events on the main explorer itself
> > later (called by a timer).... but still without any luck..
> >
> > Scott
> >
> > "Dmitry Streblechenko" <dmitry[ at ]dimastr.com> wrote in message
> > news:#kC3IJliGHA.836[ at ]TK2MSFTNGP02.phx.gbl...
> >> An obvious question: are you sure m_pExplorer is not NULL?
> >> When do you make that call?
> >>
> >> Dmitry Streblechenko (MVP)
> >> http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
> >>
> >> "news.microsoft.com" <scott_quinn[ at ]hotmail.com> wrote in message
> >> news:uurpZ4hiGHA.4284[ at ]TK2MSFTNGP05.phx.gbl...
> >> Hi,
> >>
> >> I'm having trouble sinking events on the initial Outlook explorer with
> >> the
> >> OL 2007 Beta.
> >>
> >> I get an exception (access violation) on this queryinterface all in my
> >> explorer event handler when I try to sink events.
> >>
> >> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer,
(void
> >> **)&pCPC);
> >>
> >> m_pExplorer is an Outlook::_ExplorerPtr
> >>
> >> Here's the code in context .....
> >> void CExplorerHandler::SinkEvents()
> >> {
> >> HRESULT hr;
> >>
> >> IConnectionPointContainer* pCPC;
> >> hr = m_pExplorer->QueryInterface(IID_IConnectionPointContainer,
(void
> >> **)&pCPC);
> >> if (SUCCEEDED(hr))
> >> {
> >> hr =
pCPC->FindConnectionPoint(__uuidof(Outlook::ExplorerEvents),
> >> &m_pConnection);
> >> if (SUCCEEDED(hr))
> >> {
> >> AddRef();
> >>
> >> hr = m_pConnection->Advise(static_cast<IDispatch*>(this),
> >> &m_dwCookie);
> >> }
> >>
> >> <----- SNIP ---->
> >> Now this used to work just fine on OL2003 (and OLXP and OL2000) and
also
> >> works on any additional explorers opened in Outlook 2007.
> >>
> >> It just seems to be the 1st one that causes the problem.
> >>
> >> Any ideas ? ....... A security issue ? A Microsoft bug ? Something
about
> > the
> >> timing of the Outlook startup has changed ?
> >>
> >> Regards,
> >>
> >> Scott Quinn
> >>
> >>
> >
> >
>
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net