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

    Application Hanging

    I'm creating a Windows application using Microsoft Visual C++ 2008.

    I successfully created a GUI and programmed all of its functionality. However, when I run certain functions my application will stop responding. The program will still be running nonetheless, and it will start responding once again as soon as it finishes the computational-intensive task.

    How can I avoid this? I implemented a bar to show the computation's progress, but because of the window's non-responsiveness it won't even show up!

    Thank you in advance for your help.

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Application Hanging

    How can I avoid this?
    Create a thread to do the computational-intensive task.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Application Hanging

    You should move your computational-intensive task into a worker thread. This thread will then periodically notify the main GUI thread (using PostMessage) about the "progress" and the GUI thread will update its progress bar accordingly.
    Read about worker thread in MSDN (http://msdn.microsoft.com/en-us/libr...60(VS.71).aspx) and in the Worker Threads essay
    Victor Nijegorodov

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