Kid of the neon

There is a long dialog in my application, so this dialog has a vertical scrollbar. I need that dialog's window to scroll to the top on button's click.

I tried to do it in several ways (m_hWnd - dialog's window handler):

1. :Tongue TiedendMessage(m_hWnd, WM_VSCROLL, MAKELONG(SB_TOP, 0), 0L);

this doesn't scroll

2.

SCROLLINFO si;

ZeroMemory(&si, sizeof(SCROLLINFO));

si.cbSize = sizeof(SCROLLINFO);

si.fMask = SIF_POS;

BOOL res = ::GetScrollInfo(m_hWnd, SB_VERT, &si);

si.nPos = 0;

res = :Tongue TiedetScrollInfo(m_hWnd, SB_VERT, &si, TRUE);

this scrolls only scrollbar, not whole window

3.

:Tongue TiedcrollWindowEx(m_hWnd, 0, -10, NULL, NULL, NULL, NULL, SW_ERASE);

this also doesn't scroll anything.



Re: Smart Devices Native C++ Development Scrolling under Smartphones

Christopher Fairbairn

Hi,

You could send the DM_RESETSCROLL message to your dialog, for example:

SendMessage(hWnd, DM_RESETSCROLL, TRUE, FALSE);

The TRUE parameter says to scroll back to the top, and the FALSE parameter tells the dialog not to bother recomputing the height of your dialog. You can find documentation on this window message here http://msdn2.microsoft.com/en-us/library/ms836356.aspx

Hope it helps,

Christopher Fairbairn