FIX: Invisible at Run Time ActiveX Control, Visible at Run Time (189585)



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q189585

SYMPTOMS

An invisible run-time ActiveX control is visible at run time if it is the only control on a dialog box.

CAUSE

This problem occurs because there is no other control the focus can be set to, so AppWizard-generated MFC code sets focus to the only control there (that is, returns TRUE in the OnInitDialog() function of your CDialog- derived class), and therefore activates it.

RESOLUTION

Change the return value of the OnInitDialog() function in your derived CDialog class from TRUE to FALSE.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create an MFC dialog box-based application using AppWizard.
  2. Remove all controls from the AppWizard-generated dialog box.
  3. Insert an ActiveX control that is invisible at run time (for example, Microsoft Communications Control or Microsoft Common Dialog Control).
  4. Build and run the application.
RESULTS: You should see that the ActiveX control's design-time representation is visible on the dialog box at run time.

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Yeong- Kah Tam, Microsoft Corporation

Modification Type:MajorLast Reviewed:12/10/2003
Keywords:kbBug kbContainer kbCtrl kbfix kbNoUpdate KB189585