CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Program Run-Time

    I have been working on a dialog based application. Need help about program run-time. I should call DESTROY_WINDOW or any method when my dialog has mission completed. Please sample code.

  2. #2
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Program Run-Time

    Have you used Visual Studio's AppWizard to generate your dialogue application? If you have, then the built-in framework already contains all necessary code to destroy the window when your program exits. You do not need to do anything.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Program Run-Time

    If the dialog is modal (created with DoModal) then you don't have. If it's modeless (created with Create) then you have to call DestroyWindow().
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: Program Run-Time

    OnExit(), or DestroyWindow() call. Extra Initializing code have only simple dialog based application and need to these code run-time and finally exit or destroy. Example I used to [ if ] statement to do this but it does not work. Any method program run-time or API pls sample code.
    Last edited by Hakan Bulut; September 6th, 2007 at 04:01 AM.

  5. #5
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Program Run-Time

    For us to be able to help you, you need to answer any questions that were asked.

    Please answer:
    - Did you use AppWizard to create your project?
    - Is this the only dialogue in your application, or is it a separate dialogue that you have created *yourself*?
    - If you created it yourself, show us how you created it (how you got it to show on the screen).

    Then we can show you how to destroy it.

  6. #6
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: Program Run-Time

    i want to take into considering this is a MFC application anyway "dialog based application" that is didn't created it myself. Only have one dialog in my application. ok? I hope understood.. sory

  7. #7
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Program Run-Time

    Yes, I believe you answered my question - you built a standard MFC dialog-based app using AppWizard.

    In this case, your one and only dialogue should automatically be destroyed when the user clicks the OK or Cancel buttons that are put on the resource for you.

    If you have removed the buttons, the correct way to end a dialogue is to call EndDialog(IDOK) (or you can specify IDCANCEL or IDABORT) from within the dialogue. This automatically destroys it for you, and ends your program.

  8. #8
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: Program Run-Time

    Thanks in advance but Program must automatically Exit or destroy itself. I did used to two lines code in OnInitializing and i need to my initializing code run-time or any method.

  9. #9
    Join Date
    Aug 2007
    Location
    Farnborough, Hants, UK
    Posts
    45

    Re: Program Run-Time

    EndDialog() will end your program whenever you want.

  10. #10
    Join Date
    Jun 2001
    Location
    Germany
    Posts
    136

    Re: Program Run-Time

    Thanks a lot

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