DWORD winapi pbthreadproc (lpvoid lpparameter) {hwnd hwndpb = (hwnd) lpparameter; // The Window handle pbrange range of the progress bar; // the range of the progress bar sendmessage (hwndpb, pbm_setrange, // set the progress bar range (wparam) 0, (lparam) (makelparam (0,100), sendmessage (hwndpb, pbm_getrange, // obtain the progress bar range (wparam) true, // true indicates that the returned value is the minimum value in the range. False indicates that the maximum value (lparam) & range) is returned. While (true) {sendmessage (hwndpb, pbm_deltapos, // set the new position of the progress bar to the current position plus the range 1/20 (wparam) (range. iHigh-range.iLow)/20), (lparam) 0); If (sendmessage (hwndpb, pbm_getpos, (wparam) 0, (lparam) 0) // get progress bar current position = range. ihigh) {sendmessage (hwndpb, pbm_setpos, (wparam) range. ilow, (lparam) 0); // reset the progress bar} Sleep (1000);} createthread (// the thread of the operation progress bar is null, 0, (lpthread_start_routine) pbthreadproc, hwndpb, 0, 0 );