• Welcome to Valhalla Legends Archive.
 

[vb.net]RTB Scroll

Started by mentalCo., October 27, 2004, 10:55 AM

Previous topic - Next topic

mentalCo.

Sorry for posting so much.  IS there a way to scroll a rich text box without calling focus() first?

MyndFyre

#1
To make my window's custom scrolling setup (like WoW's):



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.

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
);
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

mentalCo.

#2
How do you use sendmessage in vb.net?

edit:
heres the solution:
http://www.devcity.net/forums/topic.asp?tid=55822