• Advertisement

Archived

This topic is now archived and is closed to further replies.

Scollbar porblems

This topic is 5505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Its a win32 api pgm (ie not MFC). I can''t get scrollbar to be recognized. I have tried 2 ways: 1) add it using the IDE as a resource (IDC_SCROLLBAR1) then in the dialog procedure do case IDC_SCROLLBAR1: dy+=1; sprintf(mystring,"%f",dy);SetDlgItemText(dlg,IDC_DY,mystring ); return TRUE; (where IDC_DY is an edit box). With this way, nothing happens when I click the scollbar at runtime. 2)So the I figure perhaps I have to create scrollbar at runtime. I create a WS_CHILD, but compiler complains that my child-identifier is not of type hMenu. But MSDN says it can be an integer if the window is defined as a child!!! Arg.... What am I doing wrong? thanx CreateWindow( TEXT("SCOLLBAR"), NULL, WS_CHILD|WS_VISIBLE, 10,10, 200,20, dlg, IDC_SCROLLBAR1, <<<------copiler compains at this hInstance, NULL);

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
1) using s scrollbar resource will work just fine. when in use, scrollbar controls send either a WM_VSCROLL or a WM_HSCROLL msg, depending upon whether they are a vertical or horizontal scrollbar. you''ll have to look up the msgs themselves to find out exactly what gets sent depending upon what gets clicked on the scrollbar (thumb, arrows, shaft).

2) to indicate a resource id in CreateWindow calls, typecast the control''s id to an HMENU, e.g., (HMENU)IDC_SCROLLBAR1.

there are also functions available to set/get scrollbar info, positions, and ranges. these can be used for various purposes, such as making the scrolling position, that is returned in the WM_VSCROLL/WM_HSCROLL msgs, more closely aligned to your app''s needs, as opposed to using the defaults of the control.

Share this post


Link to post
Share on other sites

  • Advertisement