## PRB: Windows Application Displays Hourglass, then Exits

Q117144

    7.00   | 1.00 1.50 1.51 1.52
    MS-DOS | WINDOWS
    kbprg kbprb

    ----------------------------------------------------------------------
    The information in this article applies to:

     - Microsoft C/C++ for MS-DOS, version 7.0
     - Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, and 1.52
    ----------------------------------------------------------------------

    SYMPTOMS
    ========

    Running a C or C++ application for Windows that calls a DLL built with
    C/C++ for MS-DOS, version 7.0, or Visual C++ for Windows, versions 1.0 and
    1.5, exits after briefly displaying the hourglass cursor; the main window
    for the application is not displayed. This can occur when running the
    application from File Manager or when attempting to run it from within a
    debugger.

    CAUSE
    =====

    If the application was linked with an import library for a DLL, and the DLL
    was built without including a HEAPSIZE statement in the .DEF file or
    HEAPSIZE was set to 0, this behavior can occur. The default .DEF file that
    the Visual C++ Workbench creates for Windows DLLs sets HEAPSIZE to 1024. It
    only adds a .DEF file when the project does not include one already. So
    this problem could occur if a user creates a .DEF file and does not include
    a HEAPSIZE, sets HEAPSIZE to 0, or modifies the HEAPSIZE statement in the
    default .DEF file.

    Another thing that causes this problem to occur is naming your project
    using a name reserved by Windows for one of its system components. For more
    information, please see the following article in the Microsoft Knowledge
    Base:

       ARTICLE-ID: Q116492
       TITLE     : PRB: Debugger Cannot Debug DISPLAY.EXE

    RESOLUTION
    ==========

    Including a HEAPSIZE statement in the .DEF file for the DLL and specifying
    a non-zero value negates the problem.

    MORE INFORMATION
    ================

    The Windows loader detects that an error occurred when trying to run the
    application, and this is why the application exits immediately. As part of
    loading the application, Windows, using an import library, loads any DLLs
    to which that application is implicitly linked.

    The C/C++ run-time startup code for DLLs calls the Windows function
    "LocalInit" to initialize the local heap for the DLL. The LocalInit fails
    when the HEAPSIZE is unspecified or set at 0. When the call to LocalInit
    fails, the startup code returns an error indication to Windows and the
    application fails to load.

    Additional reference words: debug stop break break-point 7.00 1.00 1.50
    KBCategory: kbprg kbprb
    KBSubcategory: VCGenIss

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc150 kbvc100 kbZNotKeyword3 kbCVC700DOS kbVC151 kbVC152

Last Reviewed: May 6, 2001 © 2001 Microsoft Corporation. All rights reserved. Terms of Use.