私はpowershellでGetWindowText API関数をどのように使用できますか?PowerShellでGetWindowText API関数をどのように使用できますか?
私はこの方法で試してみました:私のような機能を使用
$stringbuilder = New-Object System.Text.StringBuilder
$stringbuilder.Capacity =256
:
$WindowTitless = $ImportDll::GetWindowText($TopWindow, $stringbuilder, 256)
が、私はエラーを得た:
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class UserWindowss {
[DllImport("user32.dll")]
public static extern IntPtr GetWindowText(IntPtr hWnd, System.Text.StringBuilder text, int count);
}
"@
をし、私はこのような文字列ビルダを作ります
ERROR: test: Failed to get active Window details. More Info: Exception calling "GetWindowText" with "3" argument(s): "Unable to find an entry point named
ERROR: 'GetWindowText' in DLL 'user32.dll'."
私はこの機能を使用するのに役立つものがありますか?あなたができる場合は儀式コード。 tnx。
の可能性のある重複した[どのように私はPowerShellでのプロセスにより、すべてのウィンドウハンドルを取得することができますか?](http://stackoverflow.com/questions/25369285/how-can-i-get-all-window-handles -by-a-process-in-powershell) – TessellatingHeckler
参考までにGet-Processのタイトルを次のように取得できます。 Get-Process | ProcessNameのような 'notepad' |あなたの助けには、MainWindowHandle、MainWindowTitle –