ID Number: Q79834
1.00
WINDOWS
buglist1.00
Summary:
PROBLEM ID: QCW9201001
SYMPTOMS
When using the Microsoft QuickC for Windows (QC/Win) compiler
version 1.0 and the QCase:W utility, code is generated for scroll
bars that causes the scroll bar paging to work incorrectly.
When the mouse cursor is placed on the scroll bar itself, clicking
the left mouse button will page up (down, left, or right) causing
the SB_PAGEUP (or SB_PAGEDOWN) message to be sent to the main
window's messaging procedure. The code generated by QCase:W for
these messages should decrease (or increase) sVPos (or sHPos) by
the amount specified for the range when creating the window in
QCase:W.
However, the range should never be less than zero or greater than
the range value, and the code generated allows this. The code
created resemble the following
case SB_PAGEUP:
sVPos-=10;
where 10 is the default range for scroll bars in QCase:W. If the
current value of sVPos is less than 10, the above calculation will
cause sVPos to return a negative value causing an illegal range. As
a result, a subsequent SB_PAGEDOWN message will not move the scroll
bar thumb to the bottom of the scroll bar, but only a fractional
distance.
CAUSE
This problem is caused by a code generation that is allowing range
overflow numbers to be generated.
RESOLUTION
Change the above code to (this is described in more detail below):
case SB_PAGEUP:
sVPos=max( 0, (int)(sVPos-10) );
This will allow range checking and the value of sVPos will never be
negative. For the horizontal scrolling, the same change must be
made for sHPos.
STATUS
Microsoft has confirmed this to be a problem in QC/Win version 1.0.
We are researching this problem and will post new information here
as it becomes available.
More Information:
To correct the problem:
1. Open QCase:W and choose New from the File menu.
2. Choose Scroll Bars from the Design menu and click the checkbox for
a vertical scroll bar. Choose OK; this will take the default value
of 10 for the range.
3. Choose Generate from the Build menu; you will be prompted to save
the file. Give it a filename with a .WIN extension and the files
associated will then be generated.
4. After the dialog box appears stating that generation was complete,
press OK and then exit QCase:W.
5. Open QC/Win and choose Open from the File menu.
6. Click the .C file generated by QCase:W and a window will appear
with that file.
7. Page down to the main window messaging procedure and search for the
SB_PAGEUP message in the WM_VSCROLL message case. Changing this
line as stated above will allow scroll bar paging to work
correctly.
Additional reference words: 1.00