WinApi - kłopot z parametrem komunikatu

0

Piszę sobie programik, nie ważne jaki, używam scrollbarów i mam problem z parametrami komunikatu WM_HSCROLL. Czy ktoś mógłby mi napisać w którymkolwiek jęzuku - najlepiej assemblerze, czy Delphi, jak otworzyć procedurę SetScrollPos urzywając w/w komunikatu. oto potrzebne opisy z WinAPi:

int SetScrollPos(

HWND hWnd,	// handle of window with scroll bar
int nBar,	// scroll bar flag
int nPos,	// new position of scroll box
BOOL bRedraw 	// redraw flag

);
hWnd

Identifies a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter.

nBar

Specifies the scroll bar to be set. This parameter can be one of the following values:

Value Meaning
SB_CTL Sets the position of the scroll box in a scroll bar control. The hWnd parameter must be the handle of the scroll bar control.
SB_HORZ Sets the position of the scroll box in a window's standard horizontal scroll bar.
SB_VERT Sets the position of the scroll box in a window's standard vertical scroll bar.

nPos

Specifies the new position of the scroll box. The position must be within the scrolling range. For more information about the scrolling range, see the SetScrollRange function.

bRedraw

Specifies whether the scroll bar is redrawn to reflect the new scroll box position. If this parameter is TRUE, the scroll bar is redrawn. If it is FALSE, the scroll bar is not redrawn.

WM_HSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle of scroll bar

nScrollCode

Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:

Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
SB_LINELEFT Scrolls left by one unit.
SB_LINERIGHT Scrolls right by one unit.
SB_PAGELEFT Scrolls left by the width of the window.
SB_PAGERIGHT Scrolls right by the width of the window.
SB_THUMBPOSITION Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.

nPos

Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.

hwndScrollBar

Value of lParam. Identifies the control if WM_HSCROLL is sent by a scroll bar control. If WM_HSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.

ps. używam odzdzielnej kontrolki SCROLLBAR

0

Nie do konca rozumiem pytanie.. co to znaczy otwórzyć procedurę przy pomocy komunikatu ? Chcesz zastąpić tą funkcję bezpośrednim wysłaniem komunikatu ?

0

Chodzi o to, że w Win api trzeba na otrzymanie komunikatu wykonać prockę SetScrollPos, ale przy użyciu wparama i lparama jakoś mi to nie wychodzi :/

0

A nie jest przypadkiem tak że ta funkcja wysyła ten komunikat a nie odwrotnie ?

0

Nie. komunikat jest wysyłany, gdy użytkownik przesunie na scrollbarze. Jeśli nie obsługuje się tego komunikatu, na nim się nic nie zmieni - wróci do wartości zero...

1 użytkowników online, w tym zalogowanych: 0, gości: 1