Add archived Siemens software
This commit is contained in:
+24
-1
@@ -80,6 +80,9 @@ public static class ScreenshotWindowApi {
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool PostMessage(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool PrintWindow(IntPtr hWnd, IntPtr hdc, uint flags);
|
||||
|
||||
}
|
||||
"@
|
||||
|
||||
@@ -434,7 +437,27 @@ try {
|
||||
|
||||
$screenshotPath = Join-Path $OutputDirectory "$Name.png"
|
||||
$borderInset = 2
|
||||
if ($ScreenshotTool.Length -gt 0 -and (Test-Path -LiteralPath $ScreenshotTool)) {
|
||||
if ($ScreenshotTool -eq "printwindow") {
|
||||
$bitmap = [System.Drawing.Bitmap]::new($window.Width, $window.Height, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||
try {
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
$deviceContext = $graphics.GetHdc()
|
||||
try {
|
||||
if (-not [ScreenshotWindowApi]::PrintWindow($window.Handle, $deviceContext, 2)) {
|
||||
throw "PrintWindow failed for window '$($window.Title)'."
|
||||
}
|
||||
}
|
||||
finally {
|
||||
$graphics.ReleaseHdc($deviceContext)
|
||||
$graphics.Dispose()
|
||||
}
|
||||
$bitmap.Save($screenshotPath, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
}
|
||||
finally {
|
||||
$bitmap.Dispose()
|
||||
}
|
||||
}
|
||||
elseif ($ScreenshotTool.Length -gt 0 -and (Test-Path -LiteralPath $ScreenshotTool)) {
|
||||
$screenshotToolName = [System.IO.Path]::GetFileName($ScreenshotTool)
|
||||
if ($screenshotToolName -ieq "winapp.exe") {
|
||||
$winappExitCode = 1
|
||||
|
||||
Reference in New Issue
Block a user