Sorry for posting so much. IS there a way to scroll a rich text box without calling focus() first?
To make my window's custom scrolling setup (like WoW's):
(http://www.armabot.net/pub/armabot-rtf-scroll.jpg)
I just checked through my code and found:
#region imports
[DllImport("user32.dll")]
private static extern bool GetScrollInfo(
IntPtr hwnd,
ScrollBarTypes fnBar,
ref SCROLLINFO lpsi
);
[DllImport("user32.dll")]
private static extern int SetScrollInfo(
IntPtr hwnd,
ScrollBarTypes fnBar,
ref SCROLLINFO lpsi,
bool fRedraw);
#endregion
Might want to check those out on MSDN. In fact, here is SetScrollInfo (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/scrollbars/scrollbarreference/scrollbarfunctions/setscrollinfo.asp).
Actually, it looks like I didn't use that. Looks like I used SendMessage:
private void btnUpAll_Click(object sender, System.EventArgs e)
{
Exports.SendMessage(
this.rtbChat.Handle,
(uint)EditBoxMessages.EM_Scroll,
ScrollBarCommands.SB_Top,
0);
OnScrollerFocused(this.btnUpAll);
this.m_fAutoScroll = false;
}
private void btnUp_Click(object sender, System.EventArgs e)
{
Exports.SendMessage(
this.rtbChat.Handle,
(uint)EditBoxMessages.EM_Scroll,
ScrollBarCommands.SB_LineUp,
0);
OnScrollerFocused(this.btnUp);
this.m_fAutoScroll = false;
}
In the Exports class, I had:
/// <summary>
/// <para>The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message. </para>
/// <para>To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread's message queue and return immediately, use the PostMessage or PostThreadMessage function.</para>
/// </summary>
/// <param name="hWnd">[in] Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.</param>
/// <param name="Msg">[in] Specifies the message to be sent.</param>
/// <param name="wParam">[in] Specifies additional message-specific information.</param>
/// <param name="lParam">[in] Specifies additional message-specific information.</param>
/// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns>
[DllImport("user32.dll")]
public static extern int SendMessage(
IntPtr hWnd,
uint Msg,
uint wParam,
uint lParam
);
How do you use sendmessage in vb.net?
edit:
heres the solution:
http://www.devcity.net/forums/topic.asp?tid=55822