CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    Join Date
    Jul 2005
    Posts
    19

    Programm exits right after start

    MFC dialog-based programm exits with code 0 right after start. I don`t even see the dialog itself appear. The thing is that it worked okay before I reinstalled Windows and now it doesn`t even start under Visual in debug mode (not to mention the release version)

    What`s the problem?

  2. #2
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Programm exits right after start

    most likelly it is missing some of its dependencies: ActiveX, DLL, COM etc
    Har Har

  3. #3
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    It doesn`t use any external dlls or ActiveX stuff.

  4. #4
    Join Date
    Feb 2002
    Location
    Krispl, Austria
    Posts
    197

    Re: Programm exits right after start

    Did you re-install Visual Studio?
    Requests such as
    "I need to write an new language compiler by next week, I have teach yourself c++ in 21 days, can someone give me example code?" will be ignored.

  5. #5
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Programm exits right after start

    MFC dialog-based programm exits with code 0 right after start. I don`t even see the dialog itself appear
    Does the output from the debugger give you any information as to how far the process went? Have you tried putting breakpoints in different parts e.g InitInstance

  6. #6
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    Yeah, I uninstalled everything, installed Windows (the same) over the last one, and reinstalled most of the software including VS

  7. #7
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Lightbulb Re: Programm exits right after start

    Quote Originally Posted by m8m
    MFC dialog-based programm exits with code 0 right after start. I don`t even see the dialog itself appear. The thing is that it worked okay before I reinstalled Windows and now it doesn`t even start under Visual in debug mode (not to mention the release version)

    What`s the problem?
    In case of ActiveXControl Some time we have to Initialize them by
    InitCommonControls() with specified option r u doing those thing.
    second did u register your control.
    did u specified all the header file in proper manner etc
    these can be some common reason
    have alook on this

  8. #8
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: Programm exits right after start

    Quote Originally Posted by m8m
    It doesn`t use any external dlls or ActiveX stuff.
    Have you tried debugging and see where does your app breaks?
    Har Har

  9. #9
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    For some reason the programm can`t be debugged. It misses some kind of debug information, so I can`t use breakpoints and stuff like that to trace where the programm exits. Maybe it is because of that app was originally written in old VC++ and then converted to new one in VS .NET 6.0

    And it doesn`t break, it just exits with code 0. I don`t really know, but I think it is the way app NORMALLY exit. Like if you clicked the red cross 8((

  10. #10
    Join Date
    Nov 2003
    Posts
    2,185

    Re: Programm exits right after start

    I had this once too. Did you add a rich edit control to your dialog?

  11. #11
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    No RichEdit. But I have progressbar, combos, radios, checksbuttons, tree, buttons and usual edits.

    What was the problem with RichEdit?

  12. #12
    Join Date
    Nov 2003
    Posts
    2,185

    Re: Programm exits right after start

    well, my application also closed with exit code 0. When researching, I found out I had to call AfxInitRichEdit();

    After that, it worked perfect. Maybe you can show us the code of your InitInstance (of the application).

  13. #13
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    BOOL CNewApp::InitInstance()
    {
    InitCommonControls();

    CWinApp::InitInstance();

    AfxEnableControlContainer();

    // Standard initialization

    #ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif
    //Enable3dControlsStatic(); // Call this when linking to MFC statically

    CNewDlg dlg;
    m_pMainWnd = &dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    }
    else if (nResponse == IDCANCEL)
    {
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    // application, rather than start the application's message pump.
    return FALSE;
    //return TRUE;
    }


    Well, this is it.

  14. #14
    Join Date
    Nov 2003
    Posts
    2,185

    Re: Programm exits right after start

    and can you show us the code of the OnInitDialog function of the CNewDlg dialog?

  15. #15
    Join Date
    Jul 2005
    Posts
    19

    Re: Programm exits right after start

    BOOL CNewDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();

    SetIcon(m_hIcon, TRUE); // Set big icon
    SetIcon(m_hIcon, FALSE); // Set small icon

    /*
    m_Tree.Initialize();
    GetChirp();
    GetLast();
    */

    return TRUE; // return TRUE unless you set the focus to a control
    }

    The commented out functions are mine, they don`t affect exiting or not exiting of app.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured