Here's some code:
LPCH pch;
LPCH pchTemp;
switch (message) /* handle the messages */
{
case WM_CREATE:
InitCommonControls();
hFile = CreateFile("C:/Starfield/NetStudio 1.5/NetStudio 1.5.exe", GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, NULL, NULL);
cb=GetFileSize(hFile, (LPDWORD) NULL);
HWND pb;
pb=CreateWindowEx(
WS_EX_CLIENTEDGE,
PROGRESS_CLASS,
"",
PBS_SMOOTH | WS_CHILD | WS_VISIBLE,
0, 0,
400, 20,
hwnd,
0,
0,
0
);
SendMessage(pb, PBM_SETBARCOLOR, 0, RGB(20,30,150));
SendMessage(pb, PBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELPARAM(0, 100));
SendMessage(pb, PBM_SETSTEP, (WPARAM)1, (LPARAM)0);
pch = (LPCH) LocalAlloc(LPTR, sizeof(char) * 2048);
pchTmp = pch;
do
{
ReadFile(hFile, pchTemp, sizeof(char) * 2048, &cb, (LPOVERLAPPED) NULL);
SendMessage(pb, PBM_STEPIT, 0, 0);
} while(cb);
CloseHandle((HANDLE)hFile);
break;
When I run the program, it only progresses for about 1 block on the bar. How do I make 1 block for every 1 percent read and progress the bar?
NOTE: Some code came from MSDN and NetStudio 1.5.exe is a program I made!