Click here to Skip to main content
15,912,082 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Captions with files Pin
enhzflep3-May-12 22:21
enhzflep3-May-12 22:21 
QuestionCan someone show me how to draw 3D lines? Pin
xy50518814-Apr-12 21:55
xy50518814-Apr-12 21:55 
AnswerRe: Can someone show me how to draw 3D lines? Pin
enhzflep14-Apr-12 23:44
enhzflep14-Apr-12 23:44 
QuestionProgress Bar not worked well with larger values? Pin
Le@rner14-Apr-12 2:43
Le@rner14-Apr-12 2:43 
AnswerRe: Progress Bar not worked well with larger values? Pin
Wes Aday14-Apr-12 2:56
professionalWes Aday14-Apr-12 2:56 
AnswerRe: Progress Bar not worked well with larger values? PinPopular
enhzflep14-Apr-12 3:04
enhzflep14-Apr-12 3:04 
GeneralRe: Progress Bar not worked well with larger values? Pin
Le@rner16-Apr-12 18:55
Le@rner16-Apr-12 18:55 
GeneralRe: Progress Bar not worked well with larger values? Pin
enhzflep16-Apr-12 20:54
enhzflep16-Apr-12 20:54 
I've just looked at the VS help for progress bars. I think you missed something in your research.

The max value for a progress bar is actually 65535 - The max value of a word. If you look at the message PBM_SETRANGE, you can see that it is used like this:
C++
PBM_SETRANGE
wParam = 0;
lParam = MAKELPARAM(nMinRange, nMaxRange);


Since a LPARAM is 32 bits wide and it must hold both the min AND the max values, you only have 16 bits per field. It therefore follows that the nMaxRange is 65555.


In the example that comes with VS2010, a progBar is used to indicate the progress of reading a file.

I've include a couple of exceprts:
C++
cb = GetFileSize(hFile, (LPDWORD) NULL);

// Set the range and increment of the progress
// bar.

SendMessage(hwndPB, PBM_SETRANGE, 0, MAKELPARAM(0, cb / 2048));
SendMessage(hwndPB, PBM_SETSTEP, (WPARAM) 1, 0);


C++
do {
    ReadFile(hFile, pchTmp, sizeof(char) * 2048, &cb, (LPOVERLAPPED) NULL);
    // TODO: Write an error handler to check that all the
    // requested data was read.
    // Include here any code that parses the
    // file.
    .
    .
    .
    // Advance the current position of the
    // progress bar by the increment.
    SendMessage(hwndPB, PBM_STEPIT, 0, 0);
} while (cb);

AnswerRe: Progress Bar not worked well with larger values? Pin
Maximilien14-Apr-12 3:34
Maximilien14-Apr-12 3:34 
QuestionCreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx13-Apr-12 10:31
professionaljkirkerx13-Apr-12 10:31 
AnswerThat was just a bad idea - went back to hide and show Pin
jkirkerx13-Apr-12 12:28
professionaljkirkerx13-Apr-12 12:28 
AnswerRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
Binu MD16-Apr-12 21:22
Binu MD16-Apr-12 21:22 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx17-Apr-12 7:12
professionaljkirkerx17-Apr-12 7:12 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
Binu MD17-Apr-12 14:59
Binu MD17-Apr-12 14:59 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx17-Apr-12 15:49
professionaljkirkerx17-Apr-12 15:49 
AnswerRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
JohnCz25-Apr-12 1:29
JohnCz25-Apr-12 1:29 
GeneralRe: CreateWindowEx, DestroyWindow, CreateWindowEx Pin
jkirkerx25-Apr-12 6:05
professionaljkirkerx25-Apr-12 6:05 
Questionhow is boost_scoped_ptr RAII ? Pin
elelont213-Apr-12 6:56
elelont213-Apr-12 6:56 
AnswerRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger13-Apr-12 10:33
professionalChris Losinger13-Apr-12 10:33 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Aescleal14-Apr-12 9:56
Aescleal14-Apr-12 9:56 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont223-May-12 4:36
elelont223-May-12 4:36 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger23-May-12 4:55
professionalChris Losinger23-May-12 4:55 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
elelont223-May-12 7:22
elelont223-May-12 7:22 
GeneralRe: how is boost_scoped_ptr RAII ? Pin
Chris Losinger23-May-12 7:29
professionalChris Losinger23-May-12 7:29 
AnswerRe: how is boost_scoped_ptr RAII ? Pin
Aescleal14-Apr-12 9:54
Aescleal14-Apr-12 9:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.