CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Posts
    21

    Preventing end of a SDI application

    Hi there,

    The application I'm working on is SDI application style.

    The InitInstance function, creates an object from my own class which will manage independant threads. After the creation of the object, the main application stops its execution, so the threads are killed !

    Here is the code :
    BOOL MyApp::InitInstance()
    {
    MyClass object;
    object.Go();
    return TRUE;
    }

    My question : how can I keep alive an application that creates an object that will manage threads ? The important fact is that the application can't enter in an eternal loop because the object created must interact with the application to give it details on its work.

    Thanks. Hope my explanations were clear to understand.


  2. #2
    Join Date
    Oct 2000
    Location
    India
    Posts
    4,620

    Re: Preventing end of a SDI application

    Hi,

    Put the line

    MyClass object;

    in your header file. It gets destroyed because it goes out of scope. All Luck.

    http://www.geocities.com/contactgirish/homepage.html>> VC++ Links,Code,Tutorials,Downloads & Notes.

    If you have some time, you can sign the guestbook there. Thank you.
    All luck and have a great day.

    Regards,
    V.Girish

    Visit www.geocities.com/contactgirish for Source code, Tutorials, FAQs and Downloads.

  3. #3
    Join Date
    May 2000
    Location
    Athens, Greece
    Posts
    37

    Re: Preventing end of a SDI application

    You define the object that initiates your threads inside the view class. The problem is ( I think ) that you define the class inside a function and when it terminates, the treads are terminated too.

    Dimitris Xernos
    Telecommunications Engineer
    Lannet SA

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