Simple Worker Thread Example

Environment: VC6 SP4, NT4 SP6

This example demonstrates how to start a worker thread from a dialog, keeping the dialog free while running a busy loop in the background. The first of three loops is run from an OnButton event by declaring a variable and calling a function from CloopClass. This is to demonstrate that the dialog can't be moved while the loop is running. The second loop is contained within the thread controller function, which starts after the first loop is done. This allows one to move the dialog while the loop runs. The third loop is created as the first one but from within the worker thread instead of the dialogs OnButton event. The dialog is still free to move while the third loop runs.

Downloads

Download demo project - 25 Kb
Date Posted: 5/17/01


Comments

  • Good Artical

    Posted by Thandava on 05/11/2011 10:52am

    Very Good Artical

    Reply
  • Simple and good demo for the beginners

    Posted by klee777 on 06/12/2009 04:00pm

    Thanks

    Reply
  • ddd

    Posted by Legacy on 05/22/2001 12:00am

    Originally posted by: huxuse

    没什么注解
    

    Reply
  • help-me

    Posted by Legacy on 05/21/2001 12:00am

    Originally posted by: haihong

    dear sir:
    
    resently,I got the sourcecode of Testthread.but the
    sourcecode don't run correctly and display:----------------
    ------------Configuration: LoopClass - Win32 Debug----------------------------------------------------------------------
    Linking...
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
    libcd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/LoopClass.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    LoopClass.exe - 4 error(s), 0 warning(s)

    Can you tell me the reason?
    anyway thank you!
    your truely haihong

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's "average" business in general is ever more reliant on technology and the Internet. Mobility is the most often cited business trend that has transformed the way many of us work and communicate. From an IT security perspective, this means that protection methods and tools from even a few years ago are rapidly becoming "unfit for purpose." This guide provides crucial facts to assist you in building a robust business case, meeting the demands of your business, and protecting against threats now and in the …

  • On-demand Event Event Date: October 23, 2014 Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this webcast to learn why physical appliances are preferable to virtual backup appliances, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds