How to implement progressbar(to show progress) using threading concept in win 32?

Posted by Rakesh on Stack Overflow See other posts from Stack Overflow or by Rakesh
Published on 2010-03-31T10:33:58Z Indexed on 2010/03/31 11:03 UTC
Read the original article Hit count: 327

Filed under:
|
|
|

I am trying to show a progress bar while my process is going on...in my application there will be a situation where I gotta read files and manipulate them(it will take some time to complete)..want to display a progress bar during this operation..the particular function I am calling is an win 32 ...so if you check my code below i am upto the point of creating the progress bar in a dialog window and creating a thread Now I dont know how to post the message and where to get the message and handle...Please help me..thanks in advance

//my  function
int Myfunction(....)
{

    HWND dialog = CreateWindowEx(0,WC_DIALOG,L"Proccessing...",WS_OVERLAPPEDWINDOW|WS_VISIBLE,
                    600,300,280,120,NULL,NULL,NULL,NULL);
    HWND pBar =  CreateWindowEx(NULL,PROGRESS_CLASS,NULL,WS_CHILD|WS_VISIBLE,40,20,200, 20,
                            dialog,(HMENU)IDD_PROGRESS,NULL,NULL);

    HANDLE getHandle = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)SetFilesForOperation(...),
                NULL,NULL,0);

}


LPARAM SetFilesForOperation(...)                            
{

    for(int index = 0;index < noOfFiles; index++)
    {


        *checkstate = *(checkState + index);
        if(*checkstate == -1)
        {
            *(getFiles+i) = new TCHAR[MAX_PATH];
            wcscpy(*(getFiles+i),*(dataFiles +index));
            i++;

        }
        else
        {
            (*tempDataFiles)->Add(*(dataFiles+index));
            *(checkState + localIndex) = *(checkState + index);
            localIndex++;
        }

        //SendMessage(pBar,PBM_SETSTEP,1,0);
    }
}

© Stack Overflow or respective owner

Related posts about threading

Related posts about progressbar