473,382 Members | 1,407 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

VC++ 6.0 - ScrollBar not functioning properly!

Hello, can anyone help me figure out what may be wrong
with my code -

In VC++ 6.0 Ive created a ScrollBar using :
--------------------------------------------
hwndScrollHue = CreateWindowEx
(WS_EX_OVERLAPPEDWINDOW, "SCROLLBAR", (LPSTR) NULL,
WS_CHILD | SBS_HORZ, 5, 100, 80, 16, hForm, (HMENU) NULL,
hInstance, (LPVOID) NULL);

ShowWindow(hwndScrollHue, SW_SHOWNORMAL);
---------------------------------------------
and then in the message loop:
---------------------------------------------
case WM_HSCROLL:

int xNewPos; // new position

switch (LOWORD(wParam))
{
// User clicked the shaft left of the scroll box.
case SB_PAGEUP:
xNewPos = xCurrentScroll - 50;
break;

// User clicked the shaft right of the scroll box.

case SB_PAGEDOWN:
xNewPos = xCurrentScroll + 50;
break;

// User clicked the left arrow.

case SB_LINEUP:
xNewPos = xCurrentScroll - 5;
break;

// User clicked the right arrow.

case SB_LINEDOWN:
xNewPos = xCurrentScroll + 5;
break;

// User dragged the scroll box.

case SB_THUMBPOSITION:
xNewPos = HIWORD(wParam);
break;

default:
xNewPos = xCurrentScroll;
};

if (xNewPos == xCurrentScroll)
break;
xCurrentScroll = xNewPos;

SCROLLINFO si;
si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
si.nMax = 300;
si.nMin = 0;
si.nPage = 4;
si.nPos = xCurrentScroll;
SetScrollInfo(hwndScrollHue, SB_HORZ, &si, TRUE);
InvalidateRect( hwndScrollHue, NULL, TRUE );
--------------------------------------------------------

I tried to fix up the scrollbar(s) according to MDSN and
some tutorials.

it doesnt really work/update the scroll bar with the new
position, and also renders the scrollbar over the old one
shifted up a few pixels up more, which is weird. Does
anyone know what I missed out or has such working code?
maybe is due to libraries or something??? I even put a
message box/debug statement and used GetScrollInfo to get
the updated position and it was updated as per wanted. Can
anyone figure out whats wrong? Thanks.

ZenMaster
Nov 16 '05 #1
0 1467

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gordon Airport | last post by:
None of the online references that I'm using or can find tell you if this can be done. It's standard practice in GUI's to have the handle of a scrollbar sized to be the proportion of total ammount...
1
by: Kristian | last post by:
I'm including an application into a customer website using an iframe. Some of the pages have a scrollbar since their height expands the height of the iframe. My problem is, I need to resize the...
1
by: Bill | last post by:
Using A2000 I put a small margin at the bottom of a textbox containing a memo field for data entry. This was to avoid the half-line which appears when you hit the bottom of the box. This seems to...
4
by: Paul T. RONG | last post by:
Dear all, Can one control the subform scrollbar through vba? For example, I would like to make two command buttons on the main form to control the subform scrollbar. Click 1st button the...
0
by: praveena | last post by:
i have implemented the notepad functionality with two richtext boxes. one to enter text and another to print line numbers accordingly. The functionality is achieved but the problem is scrollbars...
22
by: Colin McGuire | last post by:
I apologize for posting yet another scrollbar question. Here is my code. All I want is for a diagonal line to appear from coordinates (0,0) to (width,height) in a usercontrol regardless of whether...
7
by: Pachydermitis | last post by:
Hi all you Experts, I need to scroll a listbox horizontally. For the life of me I cannot get it to move. I can successfully scroll it vertically. I have the handle for the listbox and the scroll...
2
by: qhimq | last post by:
Hi windows API programmers, I'm so close to making my vertical scrollbar to work properly, except for: After pushing or dragging the scrollbar the window scrolls properly until I let go of the...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.