You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-14 22:26:29 +09:00
major update; gen 3.5
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SamplesCommon
|
||||
{
|
||||
public static class NativeMethods
|
||||
{
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
|
||||
public const int WM_VSCROLL = 277; // Vertical scroll
|
||||
public const int SB_BOTTOM = 7; // Scroll to bottom
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PeekMsg
|
||||
{
|
||||
public IntPtr hWnd;
|
||||
public Message msg;
|
||||
public IntPtr wParam;
|
||||
public IntPtr lParam;
|
||||
public uint time;
|
||||
public System.Drawing.Point p;
|
||||
}
|
||||
|
||||
[System.Security.SuppressUnmanagedCodeSecurity] // We won't use this maliciously
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern bool PeekMessage(out PeekMsg msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
|
||||
|
||||
public static bool AppStillIdle
|
||||
{
|
||||
get
|
||||
{
|
||||
PeekMsg msg;
|
||||
return !PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AppendText(RichTextBox box, string line)
|
||||
{
|
||||
try
|
||||
{
|
||||
box.AppendText(line + Environment.NewLine);
|
||||
ScrollRichTextBox(box);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void ScrollRichTextBox(RichTextBox box)
|
||||
{
|
||||
if (box == null || box.IsDisposed || box.Disposing)
|
||||
return;
|
||||
SendMessage(box.Handle, WM_VSCROLL, (IntPtr)SB_BOTTOM, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user