diff --git a/ShareX/Forms/InspectWindowForm.Designer.cs b/ShareX/Forms/InspectWindowForm.Designer.cs
index 3892d42d0..c2196a212 100644
--- a/ShareX/Forms/InspectWindowForm.Designer.cs
+++ b/ShareX/Forms/InspectWindowForm.Designer.cs
@@ -35,6 +35,7 @@ private void InitializeComponent()
this.btnInspectWindow = new System.Windows.Forms.Button();
this.btnInspectControl = new System.Windows.Forms.Button();
this.btnRefresh = new System.Windows.Forms.Button();
+ this.btnPinToTop = new System.Windows.Forms.Button();
this.pInfo.SuspendLayout();
this.SuspendLayout();
//
@@ -74,10 +75,18 @@ private void InitializeComponent()
this.btnRefresh.UseVisualStyleBackColor = true;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
+ // btnPinToTop
+ //
+ resources.ApplyResources(this.btnPinToTop, "btnPinToTop");
+ this.btnPinToTop.Name = "btnPinToTop";
+ this.btnPinToTop.UseVisualStyleBackColor = true;
+ this.btnPinToTop.Click += new System.EventHandler(this.btnPinToTop_Click);
+ //
// InspectWindowForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.btnPinToTop);
this.Controls.Add(this.btnRefresh);
this.Controls.Add(this.btnInspectControl);
this.Controls.Add(this.btnInspectWindow);
@@ -95,5 +104,6 @@ private void InitializeComponent()
private System.Windows.Forms.Button btnInspectWindow;
private System.Windows.Forms.Button btnInspectControl;
private System.Windows.Forms.Button btnRefresh;
+ private System.Windows.Forms.Button btnPinToTop;
}
}
\ No newline at end of file
diff --git a/ShareX/Forms/InspectWindowForm.cs b/ShareX/Forms/InspectWindowForm.cs
index de0dfd1d3..ba1ee0bab 100644
--- a/ShareX/Forms/InspectWindowForm.cs
+++ b/ShareX/Forms/InspectWindowForm.cs
@@ -124,5 +124,17 @@ private void btnRefresh_Click(object sender, EventArgs e)
{
UpdateWindowInfo();
}
+
+ private void btnPinToTop_Click(object sender, EventArgs e)
+ {
+ if (SelectedWindow == null) return;
+ // Determine current Pinned status to toggle pin
+ IntPtr style = NativeMethods.GetWindowLong(SelectedWindow.Handle, NativeConstants.GWL_EXSTYLE);
+ SpecialWindowHandles flag = (style.ToInt32() & (int)WindowStyles.WS_EX_TOPMOST) != 0 ?
+ SpecialWindowHandles.HWND_NOTOPMOST : SpecialWindowHandles.HWND_TOPMOST;
+
+ NativeMethods.SetWindowPos(SelectedWindow.Handle, (IntPtr)flag,
+ 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE);
+ }
}
}
\ No newline at end of file
diff --git a/ShareX/Forms/InspectWindowForm.resx b/ShareX/Forms/InspectWindowForm.resx
index 7cbf8c4a7..aa47b79b9 100644
--- a/ShareX/Forms/InspectWindowForm.resx
+++ b/ShareX/Forms/InspectWindowForm.resx
@@ -135,6 +135,9 @@
0
+
+
+
rtbInfo
@@ -172,7 +175,7 @@
$this
- 3
+ 4
8, 8
@@ -196,7 +199,7 @@
$this
- 2
+ 3
160, 8
@@ -220,7 +223,7 @@
$this
- 1
+ 2
312, 8
@@ -244,6 +247,30 @@
$this
+ 1
+
+
+ 460, 8
+
+
+ 144, 23
+
+
+ 3
+
+
+ Pin to Top
+
+
+ btnPinToTop
+
+
+ System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
0