mfc >> How can I intercept the code when a scrollbar is enabled/disabled?

by SnVhbiBEZW50 » Mon, 27 Mar 2006 06:53:34 GMT

Hi,

I have an MFC/ATL EXE using MDI which is misbehaving when the MDI child form
moves towards the edge of the MDICLIENT window. I need to intercept when the
scrollbar is enabled and disabled to see if I can figure out why it is
happening so.

I am aware of the functions ShowScrollBar and EnableScrollBar, both in Win32
and MFC. Are these the only functions capable of showing/enabling scrollbars?
If so, how can I intercept calls to them?


--
Thanks in advance,

Juan Dent, M.Sc.


mfc >> RE: How can I intercept the code when a scrollbar is enabled/disabled?

by v-terryf » Mon, 27 Mar 2006 17:00:34 GMT


Hi Juan,
Welcome to MSDN Newsgroup!

You also can use the following API to control the scrollbar, just only pass
the HWND parameter to them.
EnableScrollBar
GetScrollBarInfo
GetScrollInfo
GetScrollPos
GetScrollRange
ScrollDC
ScrollWindow
ScrollWindowEx
SetScrollInfo
SetScrollPos
SetScrollRange
ShowScrollBar

I hope the above information is helpful for you. Thanks!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
enabled/disabled?
form
the
Win32
scrollbars?




mfc >> How can I intercept the code when a scrollbar is enabled/disabled?

by AliR » Tue, 28 Mar 2006 05:50:06 GMT

You can always catch the WM_SIZE or WM_SIZING messages, one of the paramters
is the size of the window. If that size is smaller than the size returned by
the views GetTotalSize(...) then it will display the scrollbar.

for Instance, lets say that your window is large enough to not need a
scrollbar. and you are making it smaller

void CMyView::OnSize(.....,int cx,int cy)
{
CSize Size = GetTotalSize();
if (Size.cx > cx || Size.cy > cy)
{
//the scrollbar will be displayed once this function exits
}
CFormView::OnSize(....);
}

AliR.



form
the
Win32
scrollbars?




Similar Threads

1. Field Codes - enable then disable field codes on document close

2. Disable Text Wrap and Enable Horizontal ScrollBar for WebBrowser

I am navigating to text files and would like the WebBrowser control to 
    -- Not Wrap
    -- Enable Horizontal ScrollBar Always

One additional requirement is to NOT use mshtml.dll.  The reason for this is that the DLL is not installed on a users machine
by default.  In order to get it installed, you have to install an entire SDK.  I am not permitted to do this.

Any help would be appreciated.

3. Scrollbar keeps showing as disabled after datagrid is enabled - CSharp/C#

4. How to enable/disable scrollbar in CWnd on CE

On Thu, 12 Aug 2004 09:27:03 -0700, Tom
< XXXX@XXXXX.COM > wrote:

>Hi All,
>I was hoping some one could help. The EnableScrollbar function is not 
>supported on CE.
>
>I want to disable/enable the scroll bars but nothing works. The 
>SetScrollInfo docs claim that setting the SIF_DISABLENOSCROLL flag will 
>disable the bars.. it does not.  If I try to use CWnd::GetScrollBar it 
>returns NULL - even though I created the CWnd with the WS_VSCROLL and 
>WS_HSCROLL styles.

I use straight Win32, so I use EnableWindow with the HWND. The CWnd
class in MFC has an EnableWindow member, and I assume that is what you
want.

>
>I do not want to hide the scroll bars which I could probably do with the 
>CWnd::ModifyStyle function.
>
>Any help would be appreciated.
>
>Tom.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

5. Enabling/Disabling /Zc:wchar_t for Code Sections

6. Intercept ListBox scrollbar click?

7. Disable/Enable Form Objects With Code - Access Forms Programming

8. Enabling/Disabling Menus from Code

Hi all,

I would like to be able to substitue part of the following command using 
information from a recordset value. I can't seem to get it to work due to 
proper quotes in the syntax. Can anyone help me out?

I currently use:
CommandBars("HRMenu").Controls("User Admin").Visible = True

I would like to replace the "User Admin" with a value that comes from my 
recordset something like...
CommandBars("HRMenu").Controls(rst!ObjectName).Visible = True

I am getting a "Type mismatch" error when I try to use the version with the 
reference to the recordset. I think it's because of inproper quotations but I 
don't know how to do it correctly. 

Thanks in advance for your help!