Thread: Retrieving handle to child scrollbar

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    4

    Retrieving handle to child scrollbar

    How does one retrieve a handle to a scrollbar child window created by passing WS_*SCROLL as an argument to createwindowex(...)?

    Also, in the same vein, how does one go about disabling a similarly created scrollbar without hiding it?
    Last edited by rottinglich; 11-03-2004 at 04:27 AM. Reason: Additive

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Not easily. If you don't want the default behaviour that comes with WS_HSCROLL/WS_VSCROLL embedded scrollbars then don't use those styles - use a distinct scrollbar control instead.

    However, if you still want to investigate the possibility of getting the scrollbar handle etc. created as a child of another window with one of the WS_*SCROLL styles then you might want to try looking for the "scrollbar" window class name within a CBTProc hook procedure and subclassing the scrollbar(s) from there.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Ken's suggestion is close, but the class name is actually "ScrollBar".

  4. #4
    Registered User
    Join Date
    Nov 2004
    Posts
    4
    Precisely what I needed, thank you both.
    Now, about disabling thhe scroll bars...

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Actually, there's no possibility of using the CBTProc hook as I have suggested might be possible earlier because the 'scrollbars' attached to a window with one of the WS_*SCROLL styles is actually a non-client 'decoration' and not a window in its own right. You can confirm this by either trying the CBTProc hook or, more quickly, by using something like spy++.

    A fuller explanation including answers to the original question regarding disabling can be found here.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Posts
    4
    I used the Scroll Bar control you mentioned earlier and figuring out disabling was simple logic from there. Again, thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  2. Getting other processes class names
    By Hawkin in forum Windows Programming
    Replies: 3
    Last Post: 03-20-2008, 04:02 PM
  3. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM