Results 1 to 8 of 8

Thread: [RESOLVED] Help with ShowScrollBar API

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Resolved [RESOLVED] Help with ShowScrollBar API

    I can give a control scrollbars by this API , but how can I give them code , I mean how can I make them scroll something???????

    VB Code:
    1. Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
    2. Private Const SB_HORZ = 0
    3. Private Const SB_VERT = 1
    4. Private Const SB_BOTH = 3
    5. Private Sub Form_Load()
    6.     ShowScrollBar Text1.hwnd, SB_BOTH, True
    7. End Sub

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Help with ShowScrollBar API

    well there are couple of approaches - what exactly are you trying to do

  3. #3
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Help with ShowScrollBar API

    You will have to subclass your textbox and process WM_HSCROLL and WM_VSCROLL messages.
    http://msdn.microsoft.com/library/de...scrollbars.asp

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Cool Re: Help with ShowScrollBar API

    Quote Originally Posted by bushmobile
    well there are couple of approaches - what exactly are you trying to do
    I want to scroll a picbox (or any container) not a textbox actually , I just copied
    the code from API Guide

    Quote Originally Posted by moeur
    You will have to subclass your textbox and process WM_HSCROLL and WM_VSCROLL messages.
    http://msdn.microsoft.com/library/de...scrollbars.asp
    I will try it thanks

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Help with ShowScrollBar API

    Sorry but I still need some help as I couldn't understand that topic at MSDN

  6. #6
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Help with ShowScrollBar API

    Here is an example of how to do it for the vertical scrollbar and a picturebox

    You'll have to add code for the horizontal.

    You'll also have to add code to move the picture once the scrollbar position has been changed
    Attached Files Attached Files

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: [RESOLVED] Help with ShowScrollBar API

    Thank you for help , but plz can anybody send me links for subclassing tutorial

  8. #8
    Addicted Member
    Join Date
    Feb 2015
    Posts
    154

    Re: Help with ShowScrollBar API

    Quote Originally Posted by moeur View Post
    Here is an example of how to do it for the vertical scrollbar and a picturebox

    You'll have to add code for the horizontal.

    You'll also have to add code to move the picture once the scrollbar position has been changed
    January 2022: Proof that old threads can still be relevant - This may not have helped the OP back in 2006 but it sure helped to solve one of my problems today .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width