Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

progress indicator control

Status
Not open for further replies.

zigular

Technical User
Jun 29, 2004
18
DE
hello!

i want to connect the reading of a file with a progress indicator (MFC common control).

the initializing of the indicator i've already done, but now i need something like the spezific size of the file or sth like that to define my "status counter".

which possibilities do i have to realise that? i looked through the methods of [ifstream] and [CFileDialog].. but couldn't find sth helpfully.

thanks h.
 
You could always do a line count of the file, depending on how large it is though and set the progress bar range. Sometimes in my project I need to loops through the same files several times so I just count the number of lines.

Hope than helps a little,
Ron

/**************
Me: When will the project be finished?
Them: What project?
Me: The one you have been working on for the last 3 years!
Them: Ohh, we can't finish it?
Me: Why?
Them: We don't know how to program...
 
The only reasonable way I know is to use Windows ReadFileEx API call which has a parameter that you can initialize with a completition routine function:

BOOL ReadFileEx(
HANDLE hFile, // handle of file to read
LPVOID lpBuffer, // pointer to buffer
DWORD nNumberOfBytesToRead, // number of bytes to read
LPOVERLAPPED lpOverlapped, // pointer to offset
LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
// pointer to completion routine
);

Check out also the following sample from MSDN which uses this function:
"Remote: Demonstrates a Client-Server Connection"

HTH,

s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top