Microsoft KB Archive/189585

= FIX: Invisible at Run Time ActiveX Control, Visible at Run Time =

Article ID: 189585

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

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

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q189585

<div class="symptoms_section">

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

<div class="cause_section">

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.

<div class="resolution_section">

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

<div class="status_section">

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.

<div class="moreinformation_section">

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

Additional query words: ocx design time MSComm CommDlg

Keywords: kbbug kbcontainer kbctrl kbfix kbnoupdate KB189585

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.