15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Why does CPropertySheet->Create cause Access Violation?

Jeff Wishnie -- jwishnie@swellsoft.com
Thursday, February 15, 1996

In VisC++ 4.0 when I insert a Property Sheet from the Component Gallery I
get the
following output in the debugger every time I open the sheet:

First-chance exception in PropTest.exe (COMCTL32.DLL): 0xC0000005: Access
Violation

The exception _is_ handled and the app runs fine.

This didn't make me feel good so I tracked the access violation to:

CPropertySheet::Create

This method does a bunch of work to prepare to create the WinAPI window,
then it calls:

	// hook the window creation process
	AfxHookWindowCreate(this);
	HWND hWnd = (HWND)PropertySheet(&m_psh);

The "HWND hWnd = (HWND)PropertySheet(&m_psh)" line causes the access violation.

Is this a problem? Should I worry about it? What are they doing that causes
an "acceptable" access violation?

Thanks for any illumination!

- Jeff
jwishnie@swellsoft.com
415 552-3125(w)




LeRoy Baxter -- lbaxter@cinfo.com
Saturday, February 17, 1996


>From the on-line VC++4.0 documentation (Readme):

The first time a property page is created from its corresponding dialog =
resource, it may cause a first chance exception deep within =
COMCTL32.DLL. This is caused as a result of the property page changing =
the style of the dialog resource to the required style prior to creating =
the page. Because resources are generally read-only, this causes an =
exception. The exception is handled by the system, and a copy of the =
modified resource is made automatically by the system. The first-chance =
exception can thus be ignored.
 =20
Note   Since this exception must be handled by the operating system, do =
not wrap calls to CPropertySheet::DoModal with a C++ try/catch block in =
which the catch handles all exceptions, for exemaple, "catch (...)". =
This will handle the exception intended for the operating system, =
causing unpredictable behavior. Using C++ exception handling with =
specific exception types or using structured exception handling where =
the Access Violation exception is passed through to the operating system =
is safe, however.
 =20
On Thursday, February 15, 1996 12:35 PM, Jeff =
Wishnie[SMTP:jwishnie@swellsoft.com] wrote:
>In VisC++ 4.0 when I insert a Property Sheet from the Component Gallery =
I
>get the
>following output in the debugger every time I open the sheet:
>
>First-chance exception in PropTest.exe (COMCTL32.DLL): 0xC0000005: =
Access
>Violation
>
>The exception _is_ handled and the app runs fine.
>
>This didn't make me feel good so I tracked the access violation to:
>
>CPropertySheet::Create
>
>This method does a bunch of work to prepare to create the WinAPI =
window,
>then it calls:
>
>	// hook the window creation process
>	AfxHookWindowCreate(this);
>	HWND hWnd =3D (HWND)PropertySheet(&m_psh);
>
>The "HWND hWnd =3D (HWND)PropertySheet(&m_psh)" line causes the access =
violation.
>
>Is this a problem? Should I worry about it? What are they doing that =
causes
>an "acceptable" access violation?
>
>Thanks for any illumination!
>
>- Jeff
>jwishnie@swellsoft.com
>415 552-3125(w)
>
>
>


------ =_NextPart_000_01BAFD18.7D8328A0
Content-Type: application/ms-tnef




| Вернуться в корень Архива |