.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘Browser’

BUG: “Unhandled exception in EXENAME.EXE(OLE32.DLL): 0xC0000005: Access Violation” when you use an ATL Composite control on computers without Visual C++ installed

Symptoms
When you create an ATL Composite control with other ActiveX controls embedded in it, you may get an access violation in Ole32.dll. Usually, a message box is displayed with the following error message:

Unhandled exception in EXENAME.EXE(OLE32.DLL): 0xC0000005: Access ViolationYou may also see a Web Browser control displayed with the following message, instead of the child ActiveX control:
This page cannot be displayed. Usually, these controls work correctly on computers with Visual C++ installed, but they do not work on computers without Visual C++ installed.
Resolution
The ActiveX controls embedded in the Composite control may be licensed controls. Composite controls and ATL containment do not directly support creation of licensed controls.
When the Composite control attempts to create a licensed control on a computer without providing a run-time license, the Composite control fails with an HRESULT of 0×80040112 (CLASS_E_NOTLICENSED – Class is not licensed for use). The default handling of this failure creates a Web Browser control; the default handling also tries to initialize the Web Browser control with persisted properties of the licensed control. This mismatch of properties may result in an access violation in the Ole32.dll file.
If there is no access violation, the Web Browser control attempts to navigate to a URL that is the string representation of the licensed control’s CLSID. This action results in the error message “The page cannot be displayed.”

ACC2000: How to Reference Classes That Exist in Multiple Libraries

Symptoms
If your Microsoft Access database contains a reference to multiple librarydatabases, type libraries, or object libraries, it is possible for the sameclass name to exist in more than one referenced file. If you want todeclare a variable of that type, you must explicitly state which referencecontains the class that you want to use. This article shows you how tospecify a particular reference file in code.
Resolution
Suppose that your Microsoft Access database contains two references: onereference to a library database called MyDatabase, which contains a classcalled RecordSet, and another reference to Microsoft DAO 3.6 ObjectLibrary, which also contains a class called RecordSet. To dimension a variable of type RecordSet from the MyDatabase reference, you must use the following syntax:

Dim rs as MyDatabase.RecordSet If you do not explicitly declare the reference name when you dimension thevariable, whichever reference appears first in the References dialogbox is automatically assumed. If the wrong reference is assumed, you mayencounter error messages when you try to use the properties and methods ofthe declared object.
You can use the Microsoft Access Object Browser to determine the referencename. To use the Object Browser, open any module in Design view, and thenclick Object Browser on the View menu (or press the F2 key). The name that appears in the Project/Library box of the Object Browser is the name of that reference.