From: BoHuang on
I get an access violation when line 332 in winocc.cpp:

return ::ShowWindow(m_hWnd, nCmdShow);

is executed. This happens the fourth time this function is called.

When this happens, m_hWnd is a valid handle, and mCmdShow is 1.

This problem occurs only on one Vista machine but not another. I use Visual
Studio 2008.
From: Jonathan Wood on
At first blush, this line does not appear to be a line that could cause that
error unless m_hWnd is NOT valid.

Are you absolutely certain this is the line?

How did you determine that m_hWnd is valid?

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"BoHuang" <BoHuang(a)discussions.microsoft.com> wrote in message
news:86CC1083-7A8A-4CC1-A88D-E7ED7A65A462(a)microsoft.com...
>I get an access violation when line 332 in winocc.cpp:
>
> return ::ShowWindow(m_hWnd, nCmdShow);
>
> is executed. This happens the fourth time this function is called.
>
> When this happens, m_hWnd is a valid handle, and mCmdShow is 1.
>
> This problem occurs only on one Vista machine but not another. I use
> Visual
> Studio 2008.

From: BoHuang on
Well, line 329:
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));

didn't throw exception. So I assumed m_hWnd is valid.

But yes, I should be more precise in stating that the value for m_hWnd is
not NULL.

It doesn't help that the failing line is deep in the call stack.

Thanks

"Jonathan Wood" wrote:

> At first blush, this line does not appear to be a line that could cause that
> error unless m_hWnd is NOT valid.
>
> Are you absolutely certain this is the line?
>
> How did you determine that m_hWnd is valid?
>
> --
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "BoHuang" <BoHuang(a)discussions.microsoft.com> wrote in message
> news:86CC1083-7A8A-4CC1-A88D-E7ED7A65A462(a)microsoft.com...
> >I get an access violation when line 332 in winocc.cpp:
> >
> > return ::ShowWindow(m_hWnd, nCmdShow);
> >
> > is executed. This happens the fourth time this function is called.
> >
> > When this happens, m_hWnd is a valid handle, and mCmdShow is 1.
> >
> > This problem occurs only on one Vista machine but not another. I use
> > Visual
> > Studio 2008.
>
>
From: Jonathan Wood on
If you are 100% sure the line is the one causing the error, then my next
guess would be that the messages that result from calling ShowWindow() are
being handled by code that is causing an access violation.

I'm not sure how you are debugging. But you might try trapping messages in
the target window if that window is in your code.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"BoHuang" <BoHuang(a)discussions.microsoft.com> wrote in message
news:A22D1C29-B4C7-4501-A315-8267A3F20F51(a)microsoft.com...
> Well, line 329:
> ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
>
> didn't throw exception. So I assumed m_hWnd is valid.
>
> But yes, I should be more precise in stating that the value for m_hWnd is
> not NULL.
>
> It doesn't help that the failing line is deep in the call stack.
>
> Thanks
>
> "Jonathan Wood" wrote:
>
>> At first blush, this line does not appear to be a line that could cause
>> that
>> error unless m_hWnd is NOT valid.
>>
>> Are you absolutely certain this is the line?
>>
>> How did you determine that m_hWnd is valid?
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>> "BoHuang" <BoHuang(a)discussions.microsoft.com> wrote in message
>> news:86CC1083-7A8A-4CC1-A88D-E7ED7A65A462(a)microsoft.com...
>> >I get an access violation when line 332 in winocc.cpp:
>> >
>> > return ::ShowWindow(m_hWnd, nCmdShow);
>> >
>> > is executed. This happens the fourth time this function is called.
>> >
>> > When this happens, m_hWnd is a valid handle, and mCmdShow is 1.
>> >
>> > This problem occurs only on one Vista machine but not another. I use
>> > Visual
>> > Studio 2008.
>>
>>

From: Joseph M. Newcomer on
See below...
On Mon, 10 Nov 2008 10:31:02 -0800, BoHuang <BoHuang(a)discussions.microsoft.com> wrote:

>Well, line 329:
>ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
>
>didn't throw exception. So I assumed m_hWnd is valid.
****
ASSERT will NOT throw an exception; the concept is completely irrelevant. ASSERT will
create an assertion failure notification, which is not an exception.

Note that if you start with a NULL pointer, the attempt to access m_hWnd *will* throw an
exception.
****
>
>But yes, I should be more precise in stating that the value for m_hWnd is
>not NULL.
****
What is the value of 'this' at that point, and what type is it?
****
>
>It doesn't help that the failing line is deep in the call stack.
>
>Thanks
>
>"Jonathan Wood" wrote:
>
>> At first blush, this line does not appear to be a line that could cause that
>> error unless m_hWnd is NOT valid.
>>
>> Are you absolutely certain this is the line?
>>
>> How did you determine that m_hWnd is valid?
>>
>> --
>> Jonathan Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>> "BoHuang" <BoHuang(a)discussions.microsoft.com> wrote in message
>> news:86CC1083-7A8A-4CC1-A88D-E7ED7A65A462(a)microsoft.com...
>> >I get an access violation when line 332 in winocc.cpp:
>> >
>> > return ::ShowWindow(m_hWnd, nCmdShow);
>> >
>> > is executed. This happens the fourth time this function is called.
>> >
>> > When this happens, m_hWnd is a valid handle, and mCmdShow is 1.
>> >
>> > This problem occurs only on one Vista machine but not another. I use
>> > Visual
>> > Studio 2008.
>>
>>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm