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

    Angry AfxBegineThread works but madness follows

    AfxBegineThread works but madness follows

    I am new to Microsoft Visual C++ .NET multithreading
    But not new to multithreading .My application
    Loads in databases and starts a thread that opens a (tree view window)
    for each DB


    UINT dbTreeThead( LPVOID pParam )
    {
    struct _db *db = (struct _db *) pParam ;
    struct _nvdbTreeView *dbt ;

    // Allocate the DB tree view control structure and link in the DB
    dbt = (struct _nvdbTreeView *) calloc(1,sizeof(*dbt)) ;
    dbt->db = db ;
    dbt->index = db->rootIndex ;
    dbt->nvdb = db->nvdb ;
    dbt->wId = IDC_TREE1 ;
    db->treeView = dbt ;

    // Initialize and run the DB tree views dialog box
    DialogBoxParam( db->nvdb->hInst,
    (LPCTSTR) IDD_DBTREEBOX,
    NULL,
    (DLGPROC) treeBoxMain,
    (LPARAM) dbt) ;
    return 0; // thread completed successfully
    }

    for ( db = nvdb->db ; db ; db = db ->next)
    AfxBeginThread(dbTreeThead, db);

    This works Fine but you get some items form one thee view window in
    An other window

    If I put Sleep (4000) in the dispatch loop the problem is fixed of curse
    All I found out was you need to do more work to multithread dialog
    Boxes but have got lost is their eqv to AfxBeginThread ?

    And why was multithreading built in from the very start!

  2. #2
    Join Date
    Feb 2005
    Posts
    3

    Re: AfxBegineThread works but madness follows

    I meant to say
    And why was multithreading NOT! built in from the very start!

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