Rename NativeConstants class

This commit is contained in:
Jaex 2016-09-30 21:21:48 +03:00
parent 4d515d2a9e
commit eff05bc15c
9 changed files with 17 additions and 17 deletions

View file

@ -51,9 +51,9 @@ protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (clickThrough && m.Msg == (int)WindowsMessages.MOUSEACTIVATE && m.Result == (IntPtr)NativeMethods.MA_ACTIVATEANDEAT)
if (clickThrough && m.Msg == (int)WindowsMessages.MOUSEACTIVATE && m.Result == (IntPtr)NativeConstants.MA_ACTIVATEANDEAT)
{
m.Result = (IntPtr)NativeMethods.MA_ACTIVATE;
m.Result = (IntPtr)NativeConstants.MA_ACTIVATE;
}
}

View file

@ -47,7 +47,7 @@ public void UpdateCursorData()
if (NativeMethods.GetCursorInfo(out cursorInfo))
{
IsVisible = cursorInfo.flags == NativeMethods.CURSOR_SHOWING;
IsVisible = cursorInfo.flags == NativeConstants.CURSOR_SHOWING;
if (IsVisible)
{
@ -102,7 +102,7 @@ public void DrawCursorToHandle(IntPtr hdcDest, Point cursorOffset)
if (IconHandle != IntPtr.Zero)
{
Point drawPosition = new Point(Position.X - cursorOffset.X, Position.Y - cursorOffset.Y);
NativeMethods.DrawIconEx(hdcDest, drawPosition.X, drawPosition.Y, IconHandle, 0, 0, 0, IntPtr.Zero, NativeMethods.DI_NORMAL);
NativeMethods.DrawIconEx(hdcDest, drawPosition.X, drawPosition.Y, IconHandle, 0, 0, 0, IntPtr.Zero, NativeConstants.DI_NORMAL);
}
}

View file

@ -496,7 +496,7 @@ public static void SetWatermark(this TextBox textBox, string watermarkText, bool
{
if (textBox != null && textBox.IsHandleCreated && watermarkText != null)
{
NativeMethods.SendMessage(textBox.Handle, (int)NativeMethods.EM_SETCUEBANNER, showCueWhenFocus ? 1 : 0, watermarkText);
NativeMethods.SendMessage(textBox.Handle, (int)NativeConstants.EM_SETCUEBANNER, showCueWhenFocus ? 1 : 0, watermarkText);
}
}

View file

@ -80,12 +80,12 @@ public void SelectBitmap(Bitmap bitmap, int opacity = 255)
POINT sourceLocation = new POINT(0, 0);
POINT newLocation = new POINT(Left, Top);
BLENDFUNCTION blend = new BLENDFUNCTION();
blend.BlendOp = NativeMethods.AC_SRC_OVER;
blend.BlendOp = NativeConstants.AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = (byte)opacity;
blend.AlphaFormat = NativeMethods.AC_SRC_ALPHA;
blend.AlphaFormat = NativeConstants.AC_SRC_ALPHA;
NativeMethods.UpdateLayeredWindow(Handle, screenDc, ref newLocation, ref newSize, memDc, ref sourceLocation, 0, ref blend, NativeMethods.ULW_ALPHA);
NativeMethods.UpdateLayeredWindow(Handle, screenDc, ref newLocation, ref newSize, memDc, ref sourceLocation, 0, ref blend, NativeConstants.ULW_ALPHA);
}
finally
{

View file

@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License
namespace ShareX.HelpersLib
{
public static partial class NativeMethods
public static class NativeConstants
{
public const int GCL_HICONSM = -34;
public const int GCL_HICON = -14;

View file

@ -122,15 +122,15 @@ private static Icon GetSmallApplicationIcon(IntPtr handle)
{
IntPtr iconHandle;
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, ICON_SMALL2, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, NativeConstants.ICON_SMALL2, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
if (iconHandle == IntPtr.Zero)
{
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, ICON_SMALL, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, NativeConstants.ICON_SMALL, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
if (iconHandle == IntPtr.Zero)
{
iconHandle = GetClassLongPtrSafe(handle, GCL_HICONSM);
iconHandle = GetClassLongPtrSafe(handle, NativeConstants.GCL_HICONSM);
if (iconHandle == IntPtr.Zero)
{
@ -151,11 +151,11 @@ private static Icon GetBigApplicationIcon(IntPtr handle)
{
IntPtr iconHandle;
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, ICON_BIG, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
SendMessageTimeout(handle, (int)WindowsMessages.GETICON, NativeConstants.ICON_BIG, 0, SendMessageTimeoutFlags.SMTO_ABORTIFHUNG, 1000, out iconHandle);
if (iconHandle == IntPtr.Zero)
{
iconHandle = GetClassLongPtrSafe(handle, GCL_HICON);
iconHandle = GetClassLongPtrSafe(handle, NativeConstants.GCL_HICON);
}
if (iconHandle != IntPtr.Zero)

View file

@ -46,7 +46,7 @@ public class WindowInfo
public Rectangle ClientRectangle => NativeMethods.GetClientRect(Handle);
public WindowStyles Styles => (WindowStyles)NativeMethods.GetWindowLong(Handle, NativeMethods.GWL_STYLE);
public WindowStyles Styles => (WindowStyles)NativeMethods.GetWindowLong(Handle, NativeConstants.GWL_STYLE);
public Icon Icon => NativeMethods.GetApplicationIcon(Handle);

View file

@ -274,7 +274,7 @@ private void CreateMenu()
tsMain.GripMouseDown += (sender, e) =>
{
NativeMethods.ReleaseCapture(tsMain.Handle);
NativeMethods.DefWindowProc(menuForm.Handle, (uint)WindowsMessages.SYSCOMMAND, (UIntPtr)NativeMethods.MOUSE_MOVE, IntPtr.Zero);
NativeMethods.DefWindowProc(menuForm.Handle, (uint)WindowsMessages.SYSCOMMAND, (UIntPtr)NativeConstants.MOUSE_MOVE, IntPtr.Zero);
};
tsMain.SuspendLayout();

View file

@ -109,7 +109,7 @@ private void DropForm_MouseDown(object sender, MouseEventArgs e)
if (e.Button == MouseButtons.Left)
{
NativeMethods.ReleaseCapture();
NativeMethods.SendMessage(Handle, (uint)WindowsMessages.NCLBUTTONDOWN, (IntPtr)NativeMethods.HT_CAPTION, IntPtr.Zero);
NativeMethods.SendMessage(Handle, (uint)WindowsMessages.NCLBUTTONDOWN, (IntPtr)NativeConstants.HT_CAPTION, IntPtr.Zero);
}
}