Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1692
  • Last Modified:

How can scrollbars hide in RunTime?

Hi,
I created a window with scrollbar using CreateWindowEx with Style WS_CAPTION | WS_SYSMENU|WS_VSCROLL | WS_HSCROLL. and loaded images. I have a menu Item 'stretch view ',which will help to view large images to fit to screen so that a viewer can view whole image of large images without using scrollbar.Every thing worked fine except the scrollbar. My aim is to hide the scrollbar dynamically when i clicked on 'StretchView' and show it when I click in 'NormalView'.
I tried
       wndStyle |= WS_HSCROLL;
     wndStyle |= WS_VSCROLL;
            SetWindowLong(hWnd, GWL_STYLE, wndStyle);
       UpdateWindow(hWnd);
But no use..Pls Help me to find a solution of it
Thnx in advance
regards
Sujeesh

0
sujeeshlal
Asked:
sujeeshlal
  • 2
1 Solution
 
chensuCommented:
LONG lStyle = ::GetWindowLong(hWnd, GWL_STYLE);
// ASSERT(lStyle != 0);

lStyle &= ~WS_HSCROLL;
lStyle &= ~WS_VSCROLL;

LONG lOldStyle = ::SetWindowLong(hWnd, GWL_STYLE, lStyle);
// ASSERT(lOldStyle != 0);

BOOL bSucc = ::SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_DRAWFRAME | SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE);
// ASSERT(bSucc);
0
 
sujeeshlalAuthor Commented:
Thnx for ur help..but it help me to hide Horizontal scroll bar only.. But vertical scroll bar is still there.. I want to hide both of them..Y this happends so?
pls help
 
     
0
 
chensuCommented:
It seems to me that somewhere in your code directly or indirectly adds the WS_VSCROLL style back. You will have to debug it.
0
 
pcuniteCommented:
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now