* 修改了一些Win32API的引用

This commit is contained in:
Sunny 2020-10-15 22:29:13 +08:00
parent b8935ddd76
commit 9e56c8e1e6
11 changed files with 114 additions and 216 deletions

Binary file not shown.

View File

@ -741,7 +741,7 @@ namespace Sunny.UI
{
base.WndProc(ref m);
if (IsDisposed || Disposing) return;
ScrollBarInfo.ShowScrollBar(Handle, 3, false);
Win32.User.ShowScrollBar(Handle, 3, false);
}
public TreeNode CreateNode(string text, int pageIndex)

View File

@ -27,7 +27,6 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Sunny.UI
@ -585,7 +584,7 @@ namespace Sunny.UI
private IntPtr FindUpDownButton()
{
return NativeMethods.FindWindowEx(Handle, IntPtr.Zero, UpDownButtonClassName, null);
return User.FindWindowEx(Handle, IntPtr.Zero, UpDownButtonClassName, null).IntPtr();
}
public void OnPaintUpDownButton(UpDownButtonPaintEventArgs e)
@ -742,22 +741,19 @@ namespace Sunny.UI
{
if (SystemInformation.MouseButtonsSwapped)
{
return (Win32.User.GetKeyState(Win32.User.VK_RBUTTON) < 0);
}
else
{
return (Win32.User.GetKeyState(Win32.User.VK_LBUTTON) < 0);
return (User.GetKeyState(User.VK_RBUTTON) < 0);
}
return (User.GetKeyState(User.VK_LBUTTON) < 0);
}
private void DrawUpDownButton()
{
NativeMethods.RECT rect = new NativeMethods.RECT();
RECT rect = new RECT();
bool mousePress = LeftKeyPressed();
Point cursorPoint = new Point();
NativeMethods.GetCursorPos(ref cursorPoint);
NativeMethods.GetWindowRect(Handle, ref rect);
var mouseOver = NativeMethods.PtInRect(ref rect, cursorPoint);
Point cursorPoint = SystemEx.GetCursorPos();
User.GetWindowRect(Handle, ref rect);
var mouseOver = User.PtInRect(ref rect, cursorPoint);
cursorPoint.X -= rect.Left;
cursorPoint.Y -= rect.Top;
var mouseInUpButton = cursorPoint.X < clipRect.Width / 2;
@ -772,21 +768,21 @@ namespace Sunny.UI
{
switch (m.Msg)
{
case NativeMethods.WM_PAINT:
case User.WM_PAINT:
if (!_bPainting)
{
Point UpDownButtonLocation = new Point(_owner.Size.Width - 52, 0);
Size UpDownButtonSize = new Size(52, _owner.ItemSize.Height);
clipRect = new Rectangle(UpDownButtonLocation, UpDownButtonSize);
NativeMethods.MoveWindow(Handle, UpDownButtonLocation.X, UpDownButtonLocation.Y, clipRect.Width, clipRect.Height);
User.MoveWindow(Handle, UpDownButtonLocation.X, UpDownButtonLocation.Y, clipRect.Width, clipRect.Height);
PAINTSTRUCT ps = new PAINTSTRUCT();
_bPainting = true;
Win32.User.BeginPaint(m.HWnd, ref ps);
User.BeginPaint(m.HWnd, ref ps);
DrawUpDownButton();
Win32.User.EndPaint(m.HWnd, ref ps);
User.EndPaint(m.HWnd, ref ps);
_bPainting = false;
m.Result = NativeMethods.TRUE;
m.Result = Win32Helper.TRUE;
}
else
{
@ -811,54 +807,6 @@ namespace Sunny.UI
#endregion IDisposable
}
internal class NativeMethods
{
public const int WM_PAINT = 0xF;
public static readonly IntPtr TRUE = new IntPtr(1);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
internal RECT(int X, int Y, int Width, int Height)
{
this.Left = X;
this.Top = Y;
this.Right = Width;
this.Bottom = Height;
}
internal int Left;
internal int Top;
internal int Right;
internal int Bottom;
}
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(
IntPtr hwndParent,
IntPtr hwndChildAfter,
string lpszClass,
string lpszWindow);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCursorPos(ref Point lpPoint);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PtInRect([In] ref RECT lprc, Point pt);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint = true);
}
public delegate void UpDownButtonPaintEventHandler(object sender, UpDownButtonPaintEventArgs e);
public class UpDownButtonPaintEventArgs : PaintEventArgs

View File

@ -22,7 +22,6 @@
using System;
using System.ComponentModel;
using System.Media;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
@ -169,9 +168,6 @@ namespace Sunny.UI
/// </summary>
public static class Mp3Player
{
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand, System.Text.StringBuilder strReturn, int iReturnLength, IntPtr callback);
/// <summary>
/// 播放
/// </summary>
@ -179,8 +175,8 @@ namespace Sunny.UI
/// <param name="Repeat">重复</param>
public static void Play(string MP3_FileName, bool Repeat)
{
mciSendString("open \"" + MP3_FileName + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
mciSendString("play MediaFile" + (Repeat ? " repeat" : string.Empty), null, 0, IntPtr.Zero);
Win32.WinMM.mciSendString("open \"" + MP3_FileName + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
Win32.WinMM.mciSendString("play MediaFile" + (Repeat ? " repeat" : string.Empty), null, 0, IntPtr.Zero);
}
/// <summary>
@ -188,7 +184,7 @@ namespace Sunny.UI
/// </summary>
public static void Pause()
{
mciSendString("stop MediaFile", null, 0, IntPtr.Zero);
Win32.WinMM.mciSendString("stop MediaFile", null, 0, IntPtr.Zero);
}
/// <summary>
@ -196,7 +192,7 @@ namespace Sunny.UI
/// </summary>
public static void Stop()
{
mciSendString("close MediaFile", null, 0, IntPtr.Zero);
Win32.WinMM.mciSendString("close MediaFile", null, 0, IntPtr.Zero);
}
}
}

View File

@ -26,7 +26,6 @@ using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Sunny.UI
@ -168,12 +167,6 @@ namespace Sunny.UI
return path;
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
/// <summary>
/// 运行文件,当文件已经运行时调至前台
/// </summary>
@ -196,8 +189,8 @@ namespace Sunny.UI
}
IntPtr hWnd = oth.MainWindowHandle;
ShowWindowAsync(hWnd, (int)ProcessWindowStyle.Maximized);
SetForegroundWindow(hWnd);
Win32.User.ShowWindowAsync(hWnd, (int)ProcessWindowStyle.Maximized);
Win32.User.SetForegroundWindow(hWnd);
return oth;
}
}

View File

@ -19,6 +19,7 @@
* 2020-01-01: V2.2.0
******************************************************************************/
using Sunny.UI.Win32;
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
@ -27,59 +28,12 @@ namespace Sunny.UI
{
public static class ScrollBarInfo
{
public struct ScrollInfo
{
public int cbSize; //ScrollInfo结构体本身的字节大小
public int fMask; //fMask表示设置或获取哪些数据SIF_ALL所有数据成员都有效、SIF_PAGEnPage有效、SIF_POSnPos有效、SIF_RANGEnMin和nMax有效、SIF_TRACKPOSnTrackPos有效
public int nMin; //最小滚动位置
public int nMax; //最大滚动位置
public int nPage; //页面尺寸
public int nPos; //滚动块的位置
public int nTrackPos; //滚动块当前被拖动的位置不能在SetScrollInfo中指定
public int ScrollMax => (nMax + 1 - nPage);
}
//API声明
[DllImport("user32.dll")]//[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetScrollInfo(IntPtr handle, int fnBar, ref ScrollInfo si);
[DllImport("user32.dll")]//[return: MarshalAs(UnmanagedType.Bool)]
private static extern int SetScrollInfo(IntPtr handle, int fnBar, ref ScrollInfo si, bool fRedraw);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
private static extern bool PostMessage(IntPtr handle, int msg, uint wParam, uint lParam);
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
/// <summary>
/// ShowScrollBar
/// </summary>
/// <param name="hWnd">hWnd</param>
/// <param name="wBar">0:horizontal,1:vertical,3:both</param>
/// <param name="bShow">bShow</param>
/// <returns></returns>
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
//常量声明
public const int SB_HORZ = 0;//找回所指定窗体的标准水平滚动条参数
public const int SB_VERT = 1;//找回所指定窗体的标准垂直滚动条参数
public const int SB_CTL = 2;//找回滚动条控制参数
public const int SB_THUMBTRACK = 5;
public const int SIF_RANGE = 1;
public const int SIF_PAGE = 2;
public const int SIF_POS = 4;
public const int SIF_TRACKPOS = 16;
public const int SIF_DISABLENOSCROLL = 8;
public const int SIF_ALL = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS;
public const int EM_GETLINECOUNT = 0x00BA;
public const int WM_VSCROLL = 0x0115;
public const int SB_LINEUP = 0;
public const int SB_LINEDOWN = 1;
//私有方法
private static uint MakeLong(short lowPart, short highPart)
@ -97,29 +51,17 @@ namespace Sunny.UI
return SystemInformation.HorizontalScrollBarHeight;
}
//共有方法
/// <summary>
/// 获取TextBox行数
/// </summary>
/// <param name="handle">TextBox句柄</param>
/// <returns>行数</returns>
public static int GetTextBoxLineLength(IntPtr handle)
{
int cont = SendMessage(handle, EM_GETLINECOUNT, 0, 0);
return cont;
}
/// <summary>
/// 获取控件滚动条信息
/// </summary>
/// <param name="handle">控件句柄</param>
/// <returns>信息结构</returns>
public static ScrollInfo GetInfo(IntPtr handle)
public static SCROLLINFO GetInfo(IntPtr handle)
{
ScrollInfo si = new ScrollInfo();
SCROLLINFO si = new SCROLLINFO();
si.cbSize = Marshal.SizeOf(si);
si.fMask = SIF_DISABLENOSCROLL | SIF_ALL;
GetScrollInfo(handle, SB_VERT, ref si);
User.GetScrollInfo(handle, User.SB_VERT, ref si);
return si;
}
@ -130,10 +72,10 @@ namespace Sunny.UI
/// <param name="value">滚动值</param>
public static void SetScrollValue(IntPtr handle, int value)
{
ScrollInfo info = GetInfo(handle);
SCROLLINFO info = GetInfo(handle);
info.nPos = value;
SetScrollInfo(handle, SB_VERT, ref info, true);
PostMessage(handle, WM_VSCROLL, MakeLong(SB_THUMBTRACK, highPart: (short)info.nPos), 0);
User.SetScrollInfo(handle, User.SB_VERT, ref info, true);
User.PostMessage(handle, User.WM_VSCROLL, MakeLong(User.SB_THUMBTRACK, highPart: (short)info.nPos), 0);
}
/// <summary>
@ -142,7 +84,7 @@ namespace Sunny.UI
/// <param name="handle">控件句柄</param>
public static void ScrollUp(IntPtr handle)
{
SendMessage(handle, WM_VSCROLL, SB_LINEUP, 0);
User.SendMessage(handle, User.WM_VSCROLL, User.SB_LINEUP, 0);
}
/// <summary>
@ -151,7 +93,7 @@ namespace Sunny.UI
/// <param name="handle">控件句柄</param>
public static void ScrollDown(IntPtr handle)
{
SendMessage(handle, WM_VSCROLL, SB_LINEDOWN, 0);
User.SendMessage(handle, User.WM_VSCROLL, User.SB_LINEDOWN, 0);
}
}
}

View File

@ -19,13 +19,13 @@
* 2020-01-01: V2.2.0
******************************************************************************/
using Sunny.UI.Win32;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Windows.Forms;
@ -42,53 +42,22 @@ namespace Sunny.UI
/// <returns></returns>
public static Rectangle GetForegroundWindowBounds()
{
IntPtr awin = GetForegroundWindow(); //获取当前窗口句柄
IntPtr handle = User.GetForegroundWindow().IntPtr(); //获取当前窗口句柄
RECT rect = new RECT();
GetWindowRect(awin, ref rect);
User.GetWindowRect(handle, ref rect);
return new Rectangle(rect.Left, rect.Top, rect.Right - rect.Left, rect.Bottom - rect.Top);
}
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[StructLayout(LayoutKind.Sequential)]
struct RECT
{
public int Left; //最左坐标
public int Top; //最上坐标
public int Right; //最右坐标
public int Bottom; //最下坐标
}
/// <summary>
/// 获取鼠标位置
/// </summary>
/// <returns></returns>
public static Point GetCursorPos()
{
GetCursorPos(out POINT pos);
User.GetCursorPos(out POINT pos);
return new Point(pos.X, pos.Y);
}
[DllImport("user32.dll")]
static extern bool GetCursorPos(out POINT lpPoint);
[StructLayout(LayoutKind.Sequential)]
struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
this.X = x;
this.Y = y;
}
}
public static void ConsoleWriteLine(this object obj, string preText = "")
{
if (preText != "")
@ -325,8 +294,8 @@ namespace Sunny.UI
[EnvironmentPermissionAttribute(SecurityAction.LinkDemand, Unrestricted = true)]
private static void HandleRunningInstance(Process instance, int showStyle)
{
ShowWindowAsync(instance.MainWindowHandle, showStyle); //调用api函数正常显示窗口
SetForegroundWindow(instance.MainWindowHandle); //将窗口放置最前端。
User.ShowWindowAsync(instance.MainWindowHandle, showStyle); //调用api函数正常显示窗口
User.SetForegroundWindow(instance.MainWindowHandle); //将窗口放置最前端。
}
/// <summary>
@ -359,12 +328,6 @@ namespace Sunny.UI
frm.WindowState = showMax ? FormWindowState.Maximized : FormWindowState.Normal;
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
/// <summary>
/// 最小化显示
/// Hides the window and activates another window.

View File

@ -19,6 +19,7 @@
* 2020-01-01: V2.2.0
******************************************************************************/
using Sunny.UI.Win32;
using System;
using System.Collections.Specialized;
using System.ComponentModel;
@ -26,7 +27,6 @@ using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace Sunny.UI
@ -42,11 +42,6 @@ namespace Sunny.UI
[Description("文件名")]
public string FileName { get; set; } //INI文件名
[DllImport("kernel32")]
private static extern bool WritePrivateProfileString(byte[] section, byte[] key, byte[] val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(byte[] section, byte[] key, byte[] def, byte[] retVal, int size, string filePath);
/// <summary>
/// Ini文件编码格式
@ -109,7 +104,7 @@ namespace Sunny.UI
value = "";
}
return WritePrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), IniEncoding.GetBytes(value), FileName);
return Kernel.WritePrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), IniEncoding.GetBytes(value), FileName);
}
/// <summary>
@ -127,7 +122,7 @@ namespace Sunny.UI
Default = "";
}
int bufLen = GetPrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), IniEncoding.GetBytes(Default), buffer, 1024, FileName);
int bufLen = Kernel.GetPrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), IniEncoding.GetBytes(Default), buffer, 1024, FileName);
//必须设定0系统默认的代码页的编码方式否则无法支持中文
return IniEncoding.GetString(buffer, 0, bufLen).Trim();
}
@ -165,7 +160,7 @@ namespace Sunny.UI
private void GetKeys(string section, StringCollection keys)
{
byte[] buffer = new byte[65535];
int bufLen = GetPrivateProfileString(IniEncoding.GetBytes(section), null, null, buffer, 65535, FileName);
int bufLen = Kernel.GetPrivateProfileString(IniEncoding.GetBytes(section), null, null, buffer, 65535, FileName);
//对Section进行解析
GetStringsFromBuffer(buffer, bufLen, keys);
}
@ -198,7 +193,7 @@ namespace Sunny.UI
{
//Note:必须得用Bytes来实现StringBuilder只能取到第一个Section
byte[] buffer = new byte[65535];
int bufLen = GetPrivateProfileString(null, null, null, buffer, buffer.GetUpperBound(0), FileName);
int bufLen = Kernel.GetPrivateProfileString(null, null, null, buffer, buffer.GetUpperBound(0), FileName);
GetStringsFromBuffer(buffer, bufLen, sectionList);
}
@ -224,7 +219,7 @@ namespace Sunny.UI
/// <param name="section">section</param>
public void EraseSection(string section)
{
if (!WritePrivateProfileString(IniEncoding.GetBytes(section), null, null, FileName))
if (!Kernel.WritePrivateProfileString(IniEncoding.GetBytes(section), null, null, FileName))
{
throw (new ApplicationException("无法清除Ini文件中的Section"));
}
@ -237,7 +232,7 @@ namespace Sunny.UI
/// <param name="key">key</param>
public void DeleteKey(string section, string key)
{
WritePrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), null, FileName);
Kernel.WritePrivateProfileString(IniEncoding.GetBytes(section), IniEncoding.GetBytes(key), null, FileName);
}
/// <summary>
@ -247,7 +242,7 @@ namespace Sunny.UI
/// </summary>
public void UpdateFile()
{
WritePrivateProfileString(null, null, null, FileName);
Kernel.WritePrivateProfileString(null, null, null, FileName);
}
/// <summary>

View File

@ -1,8 +1,19 @@
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace Sunny.UI.Win32
{
public static class Win32Helper
{
public static readonly IntPtr TRUE = new IntPtr(1);
public static IntPtr IntPtr(this int value)
{
return new IntPtr(value);
}
}
public partial class GDI
{
[DllImport("gdi32.dll", EntryPoint = "DeleteObject", CharSet = CharSet.Ansi)]
@ -15,13 +26,28 @@ namespace Sunny.UI.Win32
public partial class User
{
[DllImport("user32.dll")]
public static extern int SetWindowRgn(IntPtr wnd, int hRgn, Boolean bRedraw);
public static extern int SetWindowRgn(IntPtr wnd, int hRgn, bool bRedraw);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, string lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint = true);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PtInRect([In] ref RECT lprc, Point pt);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
public static extern bool PostMessage(IntPtr handle, int msg, uint wParam, uint lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
}
public class Dwm
@ -43,4 +69,37 @@ namespace Sunny.UI.Win32
public int bottomHeight;
}
}
public partial class AdvApi
{
[DllImport("Advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool OpenProcessToken(IntPtr ProcessHandle, uint DesiredAccesss, out IntPtr TokenHandle);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName,
[MarshalAs(UnmanagedType.Struct)] ref LUID lpLuid);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool AdjustTokenPrivileges(IntPtr TokenHandle,
[MarshalAs(UnmanagedType.Bool)] bool DisableAllPrivileges,
[MarshalAs(UnmanagedType.Struct)] ref TOKEN_PRIVILEGES NewState,
uint BufferLength, IntPtr PreviousState, uint ReturnLength);
}
public partial class Kernel
{
[DllImport("kernel32.dll")]
public static extern IntPtr OpenThread(int dwDesiredAccess, bool bInheritHandle, IntPtr dwThreadId);
[DllImport("kernel32")]
public static extern bool WritePrivateProfileString(byte[] section, byte[] key, byte[] val, string filePath);
[DllImport("kernel32")]
public static extern int GetPrivateProfileString(byte[] section, byte[] key, byte[] def, byte[] retVal, int size, string filePath);
}
}

View File

@ -695,7 +695,7 @@ namespace Sunny.UI.Win32
public int BatteryFullLifeTime;
}
public abstract class AdvApi
public partial class AdvApi
{
[DllImport("AdvApi32")] public static extern int ImpersonateLoggedOnUser(HANDLE hToken);
[DllImport("advapi32")] public static extern int IsTextUnicode(IntPtr lpBuffer, int cb, ref int lpi);
@ -847,7 +847,7 @@ namespace Sunny.UI.Win32
[DllImport("version")] public static extern int VerQueryValue(IntPtr pBlock, string lpSubBlock, ref int lplpBuffer, ref int puLen);
}
public abstract class Kernel
public partial class Kernel
{
[DllImport("kernel32")] public static extern void OutputDebugString(string lpszOutputString);
[DllImport("KERNEL32")] public static extern int ConvertDefaultLocale(int Locale);

View File

@ -426,13 +426,15 @@ namespace Sunny.UI.Win32
}
public struct SCROLLINFO
{
public int cbSize;
public int fMask;
public int nMin;
public int nMax;
public int nPage;
public int nPos;
public int nTrackPos;
public int cbSize; //ScrollInfo结构体本身的字节大小
public int fMask; //fMask表示设置或获取哪些数据SIF_ALL所有数据成员都有效、SIF_PAGEnPage有效、SIF_POSnPos有效、SIF_RANGEnMin和nMax有效、SIF_TRACKPOSnTrackPos有效
public int nMin; //最小滚动位置
public int nMax; //最大滚动位置
public int nPage; //页面尺寸
public int nPos; //滚动块的位置
public int nTrackPos; //滚动块当前被拖动的位置不能在SetScrollInfo中指定
public int ScrollMax => (nMax + 1 - nPage);
}
public struct MSGBOXPARAMS
{