views:

59

answers:

1

Hi, I'm trying to move the scrollbar of a window programatically. I'm first sending a :

SetScrollPos(handle, 1, position, true);

and then followed by :

SendMessage(handle, 0x0115, wparam, new IntPtr(0));

The wparam is correct. When i inspect through spy++, the only difference between sending a scroll with the above code and actually scrolling is that in the actual scroll, the message nesting level is 1 but here it is zero. But that apart, all the other properties and same, the WM_VSCROLL, handle, position, wparam etc. But the programatic scroll doesn't move the bar. Any suggestions on what im doing wrong???

P.S: Trying to do this from a c# application THanks a ton!

EDIT: when i pass SB_BOTTOM to the wparam, it takes me correctly to the end of the scroll.

A: 

It is better to use SetScrollInfo function instead of manually sending messages.

arbiter
I've tried SetScrollInfo and it doesn't seem to be working for me. The SendMessage works in all cases except where i try to send an exact position with SB_THUMBPOSITION as the loword and the position as the hiword in the wparam.
kambamsu
I believe that you have wrong p/invoke for SetScrollInfo, or maybe using it incorrectly, because this function is WinApi and 100% working. Try to play with it, or show your p/invoke interfaces for SetScrollInfo and usage examples.
arbiter