FIX: CDatabase::Open Uses Wrong Handle for the Parent Window

Last reviewed: September 18, 1997
Article ID: Q125730
1.50 WINDOWS kbother kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft Foundation Classes included with:

        - Microsoft Visual C++ for Windows, version 1.5
    

SYMPTOMS

If an application calls CDatabase::Open and does not pass a data source name as the first argument, a dialog with a list of data sources is displayed. If the call to CDatabase::Open was made from a dialog box that is modal to the application's main window, the following incorrect behavior will be observed:

- Although the data source name dialog is modal, it is possible to activate

  the first dialog without first closing the data sources dialog.

- When the data source name dialog is closed, the application's main
  window is activated rather than the first dialog.

CAUSE

CDatabase::Open uses the wrong window handle for the parent window of the data source name dialog box.

RESOLUTION

Do not call CDatabase::Open to display a dialog box if there is an active popup window owned by the main application window.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ for Windows, version 1.51.

MORE INFORMATION

CDatabase::Open uses the handle associated with the main application window as the parent window handle passed to SQLDriverConnect. The handle will be not be the correct one if there are other active popup windows owned by the main application window. The correct window in that situation should be retrieved by calling GetLastActivePopup.


Additional reference words: 2.50 1.50
KBCategory: kbother kbfixlist kbbuglist
KBSubcategory: MfcDatabase
Keywords : MfcDatabase kbbuglist kbfixlist kbother
Technology : kbMfc
Version : 1.50
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.