Microsoft KB Archive/249611

= FIX: The Environment Handle Is Not Accessible When You Use Microsoft Foundation Classes Open Database Connectivity Classes =

Article ID: 249611

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.1 Subscription

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q249611

<div class="symptoms_section">

SYMPTOMS
When a program dynamically links to Microsoft Foundation Classes (MFC), the MFC Open Database Connectivity (ODBC) classes use an ODBC environment handle (HENV) that is declared local to the MFC DLL. Therefore, these programs do not have access to the MFC HENV.

<div class="cause_section">

CAUSE
This behavior occurs because the MFC ODBC classes are not designed to make the HENV available to the programmer.

<div class="status_section">

STATUS
This problem has been fixed with Microsoft Visual C++ 6.0.

Use the global MFC function AfxGetHENV to obtain the HENV.

<div class="references_section">