Added broken Time class, maybe fix Wnd32.Title
This commit is contained in:
parent
cd89f30f6d
commit
da957af741
37
W32.Test/MainForm.Designer.cs
generated
37
W32.Test/MainForm.Designer.cs
generated
@ -82,6 +82,9 @@
|
|||||||
this.desk_get = new System.Windows.Forms.Button();
|
this.desk_get = new System.Windows.Forms.Button();
|
||||||
this.desk_back = new System.Windows.Forms.Panel();
|
this.desk_back = new System.Windows.Forms.Panel();
|
||||||
this.readerUpdate = new System.Windows.Forms.Timer(this.components);
|
this.readerUpdate = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.time = new System.Windows.Forms.GroupBox();
|
||||||
|
this.time_select = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.time_set = new System.Windows.Forms.Button();
|
||||||
this.keyboard.SuspendLayout();
|
this.keyboard.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_h_bar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_h_bar)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_w_bar)).BeginInit();
|
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_w_bar)).BeginInit();
|
||||||
@ -93,6 +96,7 @@
|
|||||||
this.screen.SuspendLayout();
|
this.screen.SuspendLayout();
|
||||||
this.reader.SuspendLayout();
|
this.reader.SuspendLayout();
|
||||||
this.desk.SuspendLayout();
|
this.desk.SuspendLayout();
|
||||||
|
this.time.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// keyboard_log
|
// keyboard_log
|
||||||
@ -725,11 +729,40 @@
|
|||||||
this.readerUpdate.Interval = 50;
|
this.readerUpdate.Interval = 50;
|
||||||
this.readerUpdate.Tick += new System.EventHandler(this.readerUpdate_Tick);
|
this.readerUpdate.Tick += new System.EventHandler(this.readerUpdate_Tick);
|
||||||
//
|
//
|
||||||
|
// time
|
||||||
|
//
|
||||||
|
this.time.Controls.Add(this.time_set);
|
||||||
|
this.time.Controls.Add(this.time_select);
|
||||||
|
this.time.Location = new System.Drawing.Point(14, 486);
|
||||||
|
this.time.Name = "time";
|
||||||
|
this.time.Size = new System.Drawing.Size(287, 102);
|
||||||
|
this.time.TabIndex = 12;
|
||||||
|
this.time.TabStop = false;
|
||||||
|
this.time.Text = "CC-Functions.W32.Time";
|
||||||
|
//
|
||||||
|
// time_select
|
||||||
|
//
|
||||||
|
this.time_select.Location = new System.Drawing.Point(6, 26);
|
||||||
|
this.time_select.Name = "time_select";
|
||||||
|
this.time_select.Size = new System.Drawing.Size(205, 23);
|
||||||
|
this.time_select.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// time_set
|
||||||
|
//
|
||||||
|
this.time_set.Location = new System.Drawing.Point(217, 22);
|
||||||
|
this.time_set.Name = "time_set";
|
||||||
|
this.time_set.Size = new System.Drawing.Size(64, 27);
|
||||||
|
this.time_set.TabIndex = 1;
|
||||||
|
this.time_set.Text = "Set";
|
||||||
|
this.time_set.UseVisualStyleBackColor = true;
|
||||||
|
this.time_set.Click += new System.EventHandler(this.time_set_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(959, 595);
|
this.ClientSize = new System.Drawing.Size(959, 595);
|
||||||
|
this.Controls.Add(this.time);
|
||||||
this.Controls.Add(this.desk);
|
this.Controls.Add(this.desk);
|
||||||
this.Controls.Add(this.reader);
|
this.Controls.Add(this.reader);
|
||||||
this.Controls.Add(this.screen);
|
this.Controls.Add(this.screen);
|
||||||
@ -757,6 +790,7 @@
|
|||||||
this.screen.ResumeLayout(false);
|
this.screen.ResumeLayout(false);
|
||||||
this.reader.ResumeLayout(false);
|
this.reader.ResumeLayout(false);
|
||||||
this.desk.ResumeLayout(false);
|
this.desk.ResumeLayout(false);
|
||||||
|
this.time.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,5 +848,8 @@
|
|||||||
private System.Windows.Forms.Panel screen_img;
|
private System.Windows.Forms.Panel screen_img;
|
||||||
private System.Windows.Forms.Button screen_get;
|
private System.Windows.Forms.Button screen_get;
|
||||||
private System.Windows.Forms.Button screen_draw;
|
private System.Windows.Forms.Button screen_draw;
|
||||||
|
private System.Windows.Forms.GroupBox time;
|
||||||
|
private System.Windows.Forms.DateTimePicker time_select;
|
||||||
|
private System.Windows.Forms.Button time_set;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -47,6 +47,7 @@ namespace CC_Functions.W32.Test
|
|||||||
Wnd_action_title_get_Click(null, null);
|
Wnd_action_title_get_Click(null, null);
|
||||||
desk_get_Click(null, null);
|
desk_get_Click(null, null);
|
||||||
screen_get_Click(null, null);
|
screen_get_Click(null, null);
|
||||||
|
time_select.Value = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Wnd32 tmpWnd
|
private Wnd32 tmpWnd
|
||||||
@ -281,5 +282,7 @@ namespace CC_Functions.W32.Test
|
|||||||
g.DrawEllipse(eye,
|
g.DrawEllipse(eye,
|
||||||
new RectangleF(PointF.Subtract(makePoint(50, 50), makeSizeY(15, 15)), makeSizeY(30, 30)));
|
new RectangleF(PointF.Subtract(makePoint(50, 50), makeSizeY(15, 15)), makeSizeY(30, 30)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void time_set_Click(object sender, EventArgs e) => Time.Set(time_select.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,5 +17,21 @@ namespace CC_Functions.W32.Native
|
|||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr GetConsoleWindow();
|
public static extern IntPtr GetConsoleWindow();
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
public static extern bool SetSystemTime(ref SYSTEMTIME st);
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct SYSTEMTIME
|
||||||
|
{
|
||||||
|
public short wYear;
|
||||||
|
public short wMonth;
|
||||||
|
public short wDayOfWeek;
|
||||||
|
public short wDay;
|
||||||
|
public short wHour;
|
||||||
|
public short wMinute;
|
||||||
|
public short wSecond;
|
||||||
|
public short wMilliseconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,8 +56,8 @@ namespace CC_Functions.W32.Native
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr WindowFromPoint(int xPoint, int yPoint);
|
public static extern IntPtr WindowFromPoint(int xPoint, int yPoint);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
public static extern bool SetWindowText(IntPtr hWnd, string lpString);
|
public static extern bool SetWindowTextW(IntPtr hWnd, string lpString);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
||||||
|
23
W32/Time.cs
Normal file
23
W32/Time.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using CC_Functions.W32.Native;
|
||||||
|
|
||||||
|
namespace CC_Functions.W32
|
||||||
|
{
|
||||||
|
public static class Time
|
||||||
|
{
|
||||||
|
public static void Set(DateTime time)
|
||||||
|
{
|
||||||
|
time = time.ToUniversalTime();
|
||||||
|
kernel32.SYSTEMTIME st = new kernel32.SYSTEMTIME
|
||||||
|
{
|
||||||
|
wYear = (short) time.Year,
|
||||||
|
wMonth = (short) time.Month,
|
||||||
|
wDay = (short) time.Day,
|
||||||
|
wHour = (short) time.Hour,
|
||||||
|
wMinute = (short) time.Minute,
|
||||||
|
wSecond = (short) time.Second
|
||||||
|
};
|
||||||
|
kernel32.SetSystemTime(ref st);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,6 +71,7 @@
|
|||||||
<Compile Include="Privileges.cs" />
|
<Compile Include="Privileges.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ScreenMan.cs" />
|
<Compile Include="ScreenMan.cs" />
|
||||||
|
<Compile Include="Time.cs" />
|
||||||
<Compile Include="Wnd32.cs" />
|
<Compile Include="Wnd32.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
@ -108,7 +108,7 @@ namespace CC_Functions.W32
|
|||||||
user32.GetWindowText(HWnd, sb, sb.Capacity);
|
user32.GetWindowText(HWnd, sb, sb.Capacity);
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
set => user32.SetWindowText(HWnd, value);
|
set => user32.SetWindowTextW(HWnd, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user