|
Hobbyist Programmer
Join Date: Mar 2005
Location: United States
Posts: 124
Rep Power: 4 
|
I am actually using SendMessage(hwndPB, PBM_DELTAPOS, 20, 0); which is supposed to add to where the last step left off, which I thought would work better than doing it as a percentage. I have it set to a 0-100 range with 5 steps of 20.
This is the code for the stepping segment.
case WM_COMMAND:
/* Check the control ID, notification code and
* control handle to see if this is a button click
* message from our child button. */
if (LOWORD(wParam) == 1 &&
HIWORD(wParam) == BN_CLICKED &&
(HWND) lParam == hwndfinish)
{
/* Finish button was clicked. Close the window. */
DestroyWindow (hwnd);
}
else
{
if (LOWORD(wParam) == 2 &&
HIWORD(wParam) == BN_CLICKED &&
(HWND) lParam == hwndrcvr)
{
// Recover button was clicked. Delete files and step progress bar.
SetTextColor(hdc, RGB(255,255,255)); SetBkColor(hdc, RGB(125,125,125));
GetClientRect (hwnd, &rc);
/********************************************************/
if( remove( "C:\\AdWin\\scr1" ) == -1 )
{
rc.top = rc.top + 300;
DrawText(hdc, "Screen 1 was not locked.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
else
{
rc.top = rc.top + 300;
DrawText(hdc, "Screen 1 was Successfully Recovered.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
// Advance the current position of the
// progress bar by the increment.
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
/********************************************************/
if( remove( "C:\\AdWin\\scr2" ) == -1 )
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 2 was not locked.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
else
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 2 was Successfully Recovered.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
// Advance the current position of the
// progress bar by the increment.
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
/********************************************************/
if( remove( "C:\\AdWin\\scr3" ) == -1 )
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 3 was not locked.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
else
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 3 was Successfully Recovered.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
// Advance the current position of the
// progress bar by the increment.
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
/********************************************************/
if( remove( "C:\\AdWin\\scr4" ) == -1 )
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 4 was not locked.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
else
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 4 was Successfully Recovered.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
// Advance the current position of the
// progress bar by the increment.
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
/********************************************************/
if( remove( "C:\\AdWin\\scr5" ) == -1 )
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 5 was not locked.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
else
{
rc.top = rc.top + 20;
DrawText(hdc, "Screen 5 was Successfully Recovered.", -1, &rc,
DT_SINGLELINE | DT_CENTER | DT_TOP);
// Advance the current position of the
// progress bar by the increment.
SendMessage(hwndPB, PBM_DELTAPOS, 20, 0);
}
/********************************************************/
}
} Also, I would like that text to be displayed in the main window after the remove(); command takes place so that the end user knows if any, and what were recovered.
Thanks,
-BB98
__________________
Learning to use C++ and loving every minute of it.
|