Add "Parent" property to W32

This commit is contained in:
CreepyCrafter24 2020-04-14 14:49:22 +02:00
parent d289137096
commit b73bcce5d5
5 changed files with 195 additions and 169 deletions

View File

@ -64,6 +64,7 @@
this.wnd_select_selected = new System.Windows.Forms.Label();
this.wnd_select_self = new System.Windows.Forms.Button();
this.wnd = new System.Windows.Forms.GroupBox();
this.wnd_select_parent = new System.Windows.Forms.Button();
this.wnd_select_child = new System.Windows.Forms.Button();
this.wnd_select_list = new System.Windows.Forms.Button();
this.wnd_action_overlay = new System.Windows.Forms.CheckBox();
@ -87,10 +88,10 @@
this.time_set = new System.Windows.Forms.Button();
this.time_select = new System.Windows.Forms.DateTimePicker();
this.keyboard.SuspendLayout();
((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_y_bar)).BeginInit();
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_x_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_y_bar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.wnd_action_pos_x_bar)).BeginInit();
this.mouse.SuspendLayout();
this.power.SuspendLayout();
this.wnd.SuspendLayout();
@ -102,11 +103,9 @@
//
// keyboard_log
//
this.keyboard_log.Anchor =
((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom) |
System.Windows.Forms.AnchorStyles.Left) |
System.Windows.Forms.AnchorStyles.Right)));
this.keyboard_log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.keyboard_log.Location = new System.Drawing.Point(7, 48);
this.keyboard_log.Multiline = true;
this.keyboard_log.Name = "keyboard_log";
@ -139,11 +138,9 @@
//
// mouse_log
//
this.mouse_log.Anchor =
((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom) |
System.Windows.Forms.AnchorStyles.Left) |
System.Windows.Forms.AnchorStyles.Right)));
this.mouse_log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mouse_log.Location = new System.Drawing.Point(7, 48);
this.mouse_log.Multiline = true;
this.mouse_log.Name = "mouse_log";
@ -165,9 +162,7 @@
//
// wnd_action_pos_h_label
//
this.wnd_action_pos_h_label.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_h_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_h_label.AutoSize = true;
this.wnd_action_pos_h_label.Location = new System.Drawing.Point(135, 284);
this.wnd_action_pos_h_label.Name = "wnd_action_pos_h_label";
@ -177,9 +172,7 @@
//
// wnd_action_pos_w_label
//
this.wnd_action_pos_w_label.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_w_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_w_label.AutoSize = true;
this.wnd_action_pos_w_label.Location = new System.Drawing.Point(135, 256);
this.wnd_action_pos_w_label.Name = "wnd_action_pos_w_label";
@ -189,9 +182,7 @@
//
// wnd_action_pos_h_bar
//
this.wnd_action_pos_h_bar.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_h_bar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_h_bar.Location = new System.Drawing.Point(159, 284);
this.wnd_action_pos_h_bar.Name = "wnd_action_pos_h_bar";
this.wnd_action_pos_h_bar.Size = new System.Drawing.Size(121, 45);
@ -199,9 +190,7 @@
//
// wnd_action_pos_w_bar
//
this.wnd_action_pos_w_bar.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_w_bar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_pos_w_bar.Location = new System.Drawing.Point(159, 256);
this.wnd_action_pos_w_bar.Name = "wnd_action_pos_w_bar";
this.wnd_action_pos_w_bar.Size = new System.Drawing.Size(121, 45);
@ -209,9 +198,7 @@
//
// wnd_action_pos_y_label
//
this.wnd_action_pos_y_label.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_y_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_y_label.AutoSize = true;
this.wnd_action_pos_y_label.Location = new System.Drawing.Point(7, 284);
this.wnd_action_pos_y_label.Name = "wnd_action_pos_y_label";
@ -221,9 +208,7 @@
//
// wnd_action_pos_x_label
//
this.wnd_action_pos_x_label.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_x_label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_x_label.AutoSize = true;
this.wnd_action_pos_x_label.Location = new System.Drawing.Point(7, 256);
this.wnd_action_pos_x_label.Name = "wnd_action_pos_x_label";
@ -233,9 +218,7 @@
//
// wnd_action_pos_y_bar
//
this.wnd_action_pos_y_bar.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_y_bar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_y_bar.Location = new System.Drawing.Point(20, 284);
this.wnd_action_pos_y_bar.Name = "wnd_action_pos_y_bar";
this.wnd_action_pos_y_bar.Size = new System.Drawing.Size(121, 45);
@ -243,9 +226,7 @@
//
// wnd_action_pos_x_bar
//
this.wnd_action_pos_x_bar.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_x_bar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_pos_x_bar.Location = new System.Drawing.Point(20, 256);
this.wnd_action_pos_x_bar.Name = "wnd_action_pos_x_bar";
this.wnd_action_pos_x_bar.Size = new System.Drawing.Size(121, 45);
@ -291,13 +272,10 @@
//
// power_execute
//
this.power_execute.Anchor =
((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom) |
System.Windows.Forms.AnchorStyles.Right)));
this.power_execute.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.power_execute.BackColor = System.Drawing.Color.DarkRed;
this.power_execute.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (0)));
this.power_execute.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.power_execute.ForeColor = System.Drawing.Color.White;
this.power_execute.Location = new System.Drawing.Point(185, 22);
this.power_execute.Name = "power_execute";
@ -327,9 +305,7 @@
//
// power_mod_box
//
this.power_mod_box.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Left |
System.Windows.Forms.AnchorStyles.Right)));
this.power_mod_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.power_mod_box.FormattingEnabled = true;
this.power_mod_box.Location = new System.Drawing.Point(65, 84);
this.power_mod_box.Name = "power_mod_box";
@ -338,9 +314,7 @@
//
// power_reason_box
//
this.power_reason_box.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Left |
System.Windows.Forms.AnchorStyles.Right)));
this.power_reason_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.power_reason_box.FormattingEnabled = true;
this.power_reason_box.Location = new System.Drawing.Point(65, 53);
this.power_reason_box.Name = "power_reason_box";
@ -358,9 +332,7 @@
//
// power_mode_box
//
this.power_mode_box.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Left |
System.Windows.Forms.AnchorStyles.Right)));
this.power_mode_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.power_mode_box.FormattingEnabled = true;
this.power_mode_box.Location = new System.Drawing.Point(65, 22);
this.power_mode_box.Name = "power_mode_box";
@ -401,9 +373,7 @@
//
// wnd_action_enabled
//
this.wnd_action_enabled.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_enabled.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_enabled.AutoSize = true;
this.wnd_action_enabled.Location = new System.Drawing.Point(7, 167);
this.wnd_action_enabled.Name = "wnd_action_enabled";
@ -415,9 +385,7 @@
//
// wnd_action_title_get
//
this.wnd_action_title_get.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_title_get.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_title_get.Location = new System.Drawing.Point(237, 159);
this.wnd_action_title_get.Name = "wnd_action_title_get";
this.wnd_action_title_get.Size = new System.Drawing.Size(43, 27);
@ -484,6 +452,7 @@
//
// wnd
//
this.wnd.Controls.Add(this.wnd_select_parent);
this.wnd.Controls.Add(this.wnd_select_child);
this.wnd.Controls.Add(this.wnd_select_list);
this.wnd.Controls.Add(this.wnd_action_overlay);
@ -518,6 +487,16 @@
this.wnd.TabStop = false;
this.wnd.Text = "CC-Functions.W32.Wnd32";
//
// wnd_select_parent
//
this.wnd_select_parent.Location = new System.Drawing.Point(207, 122);
this.wnd_select_parent.Name = "wnd_select_parent";
this.wnd_select_parent.Size = new System.Drawing.Size(74, 27);
this.wnd_select_parent.TabIndex = 27;
this.wnd_select_parent.Text = "Parent";
this.wnd_select_parent.UseVisualStyleBackColor = true;
this.wnd_select_parent.Click += new System.EventHandler(this.wnd_select_parent_Click);
//
// wnd_select_child
//
this.wnd_select_child.Location = new System.Drawing.Point(107, 122);
@ -540,9 +519,7 @@
//
// wnd_action_overlay
//
this.wnd_action_overlay.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_overlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_overlay.AutoSize = true;
this.wnd_action_overlay.Location = new System.Drawing.Point(162, 167);
this.wnd_action_overlay.Name = "wnd_action_overlay";
@ -554,24 +531,19 @@
//
// wnd_action_style
//
this.wnd_action_style.Anchor =
((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left) |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_style.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_style.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.wnd_action_style.FormattingEnabled = true;
this.wnd_action_style.Location = new System.Drawing.Point(7, 195);
this.wnd_action_style.Name = "wnd_action_style";
this.wnd_action_style.Size = new System.Drawing.Size(238, 23);
this.wnd_action_style.TabIndex = 24;
this.wnd_action_style.SelectedIndexChanged +=
new System.EventHandler(this.Wnd_action_style_SelectedIndexChanged);
this.wnd_action_style.SelectedIndexChanged += new System.EventHandler(this.Wnd_action_style_SelectedIndexChanged);
//
// wnd_action_visible
//
this.wnd_action_visible.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_visible.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.wnd_action_visible.AutoSize = true;
this.wnd_action_visible.Location = new System.Drawing.Point(90, 167);
this.wnd_action_visible.Name = "wnd_action_visible";
@ -583,9 +555,7 @@
//
// wnd_action_icon
//
this.wnd_action_icon.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_icon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.wnd_action_icon.BackColor = System.Drawing.SystemColors.ControlLight;
this.wnd_action_icon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.wnd_action_icon.Location = new System.Drawing.Point(253, 193);
@ -614,9 +584,7 @@
//
// screen_draw
//
this.screen_draw.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.screen_draw.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.screen_draw.Location = new System.Drawing.Point(188, 168);
this.screen_draw.Name = "screen_draw";
this.screen_draw.Size = new System.Drawing.Size(87, 27);
@ -627,9 +595,7 @@
//
// screen_get
//
this.screen_get.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.screen_get.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.screen_get.Location = new System.Drawing.Point(7, 168);
this.screen_get.Name = "screen_get";
this.screen_get.Size = new System.Drawing.Size(87, 27);
@ -640,11 +606,9 @@
//
// screen_img
//
this.screen_img.Anchor =
((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom) |
System.Windows.Forms.AnchorStyles.Left) |
System.Windows.Forms.AnchorStyles.Right)));
this.screen_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.screen_img.BackColor = System.Drawing.Color.White;
this.screen_img.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.screen_img.Location = new System.Drawing.Point(7, 22);
@ -697,9 +661,7 @@
//
// desk_set
//
this.desk_set.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Right)));
this.desk_set.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.desk_set.Location = new System.Drawing.Point(101, 156);
this.desk_set.Name = "desk_set";
this.desk_set.Size = new System.Drawing.Size(79, 27);
@ -710,9 +672,7 @@
//
// desk_get
//
this.desk_get.Anchor =
((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom |
System.Windows.Forms.AnchorStyles.Left)));
this.desk_get.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.desk_get.Location = new System.Drawing.Point(7, 156);
this.desk_get.Name = "desk_get";
this.desk_get.Size = new System.Drawing.Size(87, 27);
@ -723,11 +683,9 @@
//
// desk_back
//
this.desk_back.Anchor =
((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Bottom) |
System.Windows.Forms.AnchorStyles.Left) |
System.Windows.Forms.AnchorStyles.Right)));
this.desk_back.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.desk_back.BackColor = System.Drawing.Color.White;
this.desk_back.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.desk_back.Location = new System.Drawing.Point(7, 22);
@ -789,10 +747,10 @@
this.Text = "CC-Functions.W32.Test";
this.keyboard.ResumeLayout(false);
this.keyboard.PerformLayout();
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_h_bar)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_w_bar)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_y_bar)).EndInit();
((System.ComponentModel.ISupportInitialize) (this.wnd_action_pos_x_bar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wnd_action_pos_h_bar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wnd_action_pos_w_bar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wnd_action_pos_y_bar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wnd_action_pos_x_bar)).EndInit();
this.mouse.ResumeLayout(false);
this.mouse.PerformLayout();
this.power.ResumeLayout(false);
@ -804,6 +762,7 @@
this.desk.ResumeLayout(false);
this.time.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
@ -864,5 +823,6 @@
private System.Windows.Forms.DateTimePicker time_select;
private System.Windows.Forms.Button time_set;
private System.Windows.Forms.Button wnd_select_child;
private System.Windows.Forms.Button wnd_select_parent;
}
}

View File

@ -84,7 +84,100 @@ namespace CC_Functions.W32.Test
private void wnd_select_list_Click(object sender, EventArgs e) =>
TmpWnd = SelectBox.Show(Wnd32.Visible, "Please select a window") ?? TmpWnd;
private void wnd_select_child_Click(object sender, EventArgs e) => TmpWnd = SelectBox.Show(TmpWnd.Children, "Please select a window") ?? TmpWnd;
private void wnd_select_parent_Click(object sender, EventArgs e) => TmpWnd = TmpWnd.Parent;
private void wnd_select_child_Click(object sender, EventArgs e)
{
if (TmpWnd.HWnd != Handle && !this.GetWnd32().Children.Contains(TmpWnd))
{
WindowState = FormWindowState.Minimized;
TmpWnd.Enabled = false;
}
Wnd32.FromForm(this).IsForeground = true;
Form frm = new Form
{
BackColor = Color.White,
Opacity = 0.4f,
FormBorderStyle = FormBorderStyle.None,
WindowState = FormWindowState.Maximized
};
Label lab = new Label { AutoSize = true };
frm.Controls.Add(lab);
Panel pan = new Panel { BackColor = Color.Red };
frm.Controls.Add(pan);
Wnd32[] children = TmpWnd.Children;
void UpdateGUI(Point labelPosition)
{
lab.Text = $"{_wndSelectMouseCurrent.Title} ({_wndSelectMouseCurrent.HWnd})";
lab.Location = new Point(labelPosition.X + 5, labelPosition.Y + 5);
pan.Bounds = _wndSelectMouseCurrent.Position;
}
void MouseEventHandler(object sender1, MouseEventArgs e1)
{
Func<Wnd32, bool> checkWnd = (s) => s.Position.Contains(e1.Location);
if (children.Any(checkWnd))
{
_wndSelectMouseCurrent = children.First(checkWnd);
UpdateGUI(Cursor.Position);
}
}
void EventHandler(object sender1, EventArgs e1)
{
frm.Hide();
frm.WindowState = FormWindowState.Minimized;
Wnd32 tmp = _wndSelectMouseCurrent;
TmpWnd.Enabled = true;
TmpWnd.IsForeground = true;
TmpWnd = tmp;
_mainF.WindowState = FormWindowState.Normal;
frm.Close();
}
void KeyEventHandler(object sender1, KeyEventArgs e1)
{
int tmp;
switch (e1.KeyCode)
{
case Keys.Escape:
frm.Close();
break;
case Keys.Up:
case Keys.Left:
tmp = Array.IndexOf(children, _wndSelectMouseCurrent);
if (tmp == 0)
tmp = children.Length;
tmp--;
_wndSelectMouseCurrent = children[tmp];
UpdateGUI(_wndSelectMouseCurrent.Position.Location);
break;
case Keys.Down:
case Keys.Right:
tmp = Array.IndexOf(children, _wndSelectMouseCurrent);
tmp++;
if (tmp == children.Length)
tmp = 0;
_wndSelectMouseCurrent = children[tmp];
UpdateGUI(_wndSelectMouseCurrent.Position.Location);
break;
}
}
frm.Click += EventHandler;
pan.Click += EventHandler;
lab.Click += EventHandler;
frm.MouseMove += MouseEventHandler;
pan.MouseMove += MouseEventHandler;
lab.MouseMove += MouseEventHandler;
frm.KeyDown += KeyEventHandler;
UpdateGUI(Cursor.Position);
frm.Show();
_wndSelectMouseCurrent = frm.GetWnd32();
Cursor.Position = Cursor.Position;
frm.GetWnd32().Overlay = true;
}
private void Wnd_select_title_button_Click(object sender, EventArgs e) =>
TmpWnd = Wnd32.FromMetadata(null, wnd_select_title_box.Text);
@ -148,6 +241,16 @@ namespace CC_Functions.W32.Test
{
// ignored
}
try
{
wnd_select_parent.Tag = TmpWnd.Parent;
wnd_select_parent.Enabled = true;
}
catch
{
wnd_select_parent.Enabled = false;
}
}
private void Wnd_action_enabled_CheckedChanged(object sender, EventArgs e) =>
@ -178,12 +281,17 @@ namespace CC_Functions.W32.Test
Panel pan = new Panel {BackColor = Color.Red};
frm.Controls.Add(pan);
void UpdateGUI(Point labelPosition)
{
lab.Text = $"{_wndSelectMouseCurrent.Title} ({_wndSelectMouseCurrent.HWnd})";
lab.Location = new Point(labelPosition.X + 5, labelPosition.Y + 5);
pan.Bounds = _wndSelectMouseCurrent.Position;
}
void MouseEventHandler(object sender1, MouseEventArgs e1)
{
_wndSelectMouseCurrent = Wnd32.AllFromPoint(MousePosition, true).First(s => s != frm.GetWnd32());
lab.Text = $"{_wndSelectMouseCurrent.Title} ({_wndSelectMouseCurrent.HWnd})";
lab.Location = new Point(Cursor.Position.X + 5, Cursor.Position.Y + 5);
pan.Bounds = _wndSelectMouseCurrent.Position;
UpdateGUI(Cursor.Position);
}
void EventHandler(object sender1, EventArgs e1)
@ -198,13 +306,20 @@ namespace CC_Functions.W32.Test
frm.Close();
}
void KeyEventHandler(object sender1, KeyEventArgs e1)
{
if (e1.KeyCode == Keys.Escape)
frm.Close();
}
frm.Click += EventHandler;
pan.Click += EventHandler;
lab.Click += EventHandler;
frm.MouseMove += MouseEventHandler;
pan.MouseMove += MouseEventHandler;
lab.MouseMove += MouseEventHandler;
frm.KeyDown += KeyEventHandler;
frm.Show();
_wndSelectMouseCurrent = frm.GetWnd32();
Cursor.Position = Cursor.Position;

View File

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
@ -117,7 +57,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="readerUpdate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -134,5 +134,8 @@ namespace CC_Functions.W32.Native
[DllImport("user32")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr lParam);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern IntPtr GetParent(IntPtr hWnd);
}
}

View File

@ -127,6 +127,17 @@ namespace CC_Functions.W32
}
}
public Wnd32 Parent
{
get
{
IntPtr result = user32.GetParent(HWnd);
if (result == IntPtr.Zero)
throw new Win32Exception(Marshal.GetLastWin32Error());
return FromHandle(result);
}
}
/// <summary>
/// The windows title
/// </summary>