473,563 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_OVERLAPP EDWINDOW, "SCROLLBAR" , (LPSTR) NULL,
WS_CHILD | SBS_HORZ, 5, 100, 80, 16, hForm, (HMENU) NULL,
hInstance, (LPVOID) NULL);

ShowWindow(hwnd ScrollHue, 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_THUMBPOSITIO N:
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(h wndScrollHue, 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 1479

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

Similar topics

3
2065
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 of viewable data to the ammount you can see in the current view region. (I think that explains it, you know what I mean.) I have a scrollbar...
1
2175
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 width of my layout if a page in the application uses a scrollbar, some of the pages show lists of search results so I do now know the pages the...
1
1787
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 have turned off the vertical scrollbar which had worked perfectly up until then - only appearing when focussed. Now the only way to get to text past...
4
16429
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 subform vertical scrollbar goes down to the end, click 2nd button goes up to the top position. Thank you for your help,
0
1037
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 are appearing for the line numbers textbox. If i put the scrollbar property to none the line numbers when exceeded the page size are not moving up...
22
2337
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 the user autoscrolls the usercontrol (other things that are on the usercontrol I want to scroll, but haven't included any here). Here are the...
7
9358
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 bar. I have even tried sending it vbKeyRight to no avail, but it doesn't register the key strokes. I am using lDirection = WM_HSCROLL
2
2304
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 mouse. When I let go the window scrolls another unit to which I don't want to happen. I want to have the scrollbar place the window where it was set...
7
8432
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 this installer will install them. But what about the situation where VC runtime has already been installed? In fact it's been installed twice. ...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.