Thread: thread/pipe/channel ?

  1. #1
    Unregistered
    Guest

    thread/pipe/channel ?

    my prob is that i have a for loop when someone clicks a button on the dialog, it goes like this:
    Code:
    for (int i=0;i<100;i++)
    {
    SetDlgItemInt(haha,haha,haha,i,haha);
    }
    so i set a control with a int and it increases until it gets to 100. but this causes the programs proc to freeze until i gets to 100, so i was thinking somthing like createthread() might be necessary but that takes the ........ so is there anything else that could be a solution? another kind of msg proc perhaps?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    If you are doing this inside your windows function, (in a WM_COMMAND handler or something), then the message loop in your main() is not going to be able to process any messages, so, yes, it will seem to freeze the ptrogram until the loop completes.

    Explain what you are trying to do.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Unregistered
    Guest
    I wanted to use something other than CreateThread() to prevent my program from freezing until the loop completes because I can barely understand CreateThread() but I managed to use it anyway like so:
    Code:
    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadFunc, NULL, 0, NULL);
    Am I using it properly, would I want to bother with those other parameters?

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    If you don't need the other parameters, don't use them. Be careful with CreateThread(), if you use the standard library routines at the same time as CreateThread() you can give yourself memory leak problems. beginthread() is a safer alternative.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed