Not able to display the progress bar using threading concept?

Posted by Rakesh on Stack Overflow See other posts from Stack Overflow or by Rakesh
Published on 2010-04-01T04:03:16Z Indexed on 2010/04/01 4:13 UTC
Read the original article Hit count: 320

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 able to display the progressbar but it doesnt show any progress..actually its not doing any further process...Please help me..thanks in advance

//my function int Myfunction(....) { MSG msg; 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); SendMessage(pBar,PBM_SETRANGE,0,MAKELPARAM(0,noOfFile));

  while(GetMessage(&msg,NULL,0,0))

{ TranslateMessage(&msg); Dispatch(&message); }

 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++;
  }

  PostMessage(pBar,PBM_SETPOS,(WPARAM)index,0);
 }
}

© Stack Overflow or respective owner

Related posts about threading

Related posts about progressbar