Page 1 of 1

H-Scrollbar

Posted: 22 Oct 2008, 21:20
by aka
Dear Timo,

after a long break due to healthy problems, I recently started VB6-programming again. Right now I work on several projects in which the ExplorerTreeView plays a major role. I would like to get rid of the horizontal scrollbar and tried it with following code (VB6/SP6, WinXP/SP1):

Private Sub Command1_Click()

Dim R As Rect
Dim Style As Long

'Toggle H-ScrollBar
Style = GetWindowLong(ETV.hWnd, GWL_STYLE)
If (Style And WS_HSCROLL) Then
Style = Style - WS_HSCROLL
Else
Style = Style Or WS_HSCROLL
End If
SetWindowLong ETV.hWnd, GWL_STYLE, Style
GetWindowRect ETV.hWnd, R
SetWindowPos ETV.hWnd, 0, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_FRAMECHANGED
ETV.SetFocus

End Sub

The Result is an empty ExplorerTreeView (Version 1.14.1/857), except the toolbox bitmap. Do you have any idea how to realize my wish?

Thanks in advance an best regards

aka

Re: H-Scrollbar

Posted: 23 Oct 2008, 00:17
by TiKu
Hi,

the toolbox bitmap is from the treeview's parent window (the UserControl window). I guess your call to SetWindowPos is wrong. Try this:

Code: Select all

SetWindowPos ETV.hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED Or SWP_NOREPOSITION Or SWP_NOSIZE Or SWP_NOZORDER
By the way, this code:

Code: Select all

Style = Style - WS_HSCROLL
is bad style. You should use this instead:

Code: Select all

Style = Style And Not WS_HSCROLL
HTH
TiKu

Posted: 23 Oct 2008, 13:45
by aka
Hi TiKu,

thanks a lot for your fast reply. The code you gave me works very well.
Many thanks for this too.

Best regard
aka