powershell 코드를 사용하면 창 위치를 바꿀 수 있습니다 (올바르게 작동 함).이 창을 항상 위에 표시하십시오.Powershell - SetForegroundWindow
내 코드를 검색 :
Import-Module C:/install/WASP/wasp.dll
for($i=1; $i -le 300000; $i++)
{
$allWindow = Select-Window MyCheck*
if($allWindow)
{
foreach ($currentWindow in $allWindow)
{
$positionWindow = WindowPosition $currentWindow
foreach ($currentPosition in $positionWindow)
{
#if we find the correct windows
if ($currentWindow.title -match "\([0-9]*\)#")
{
#write-host "@@##@@"$currentWindow.title",(@@#@@)"$currentPosition.x",(@@#@@)"$currentPosition.y",(@@#@@)"$currentPosition.width",(@@#@@)"$currentPosition.height",(@@#@@)"$currentWindow.title",(@@#@@)"$currentWindow.IsActive
$id = $currentWindow.title.Substring($currentWindow.title.IndexOf("(")+1, $currentWindow.title.IndexOf(")")-$currentWindow.title.IndexOf("(")-1)
$allHUDWindow = Select-Window * | where {$_.Title -match "\($id\).*.txt"}
#If we find the second window, we have to superimpose $currentHUDWindow to $currentWindow
if($allHUDWindow)
{
foreach ($currentHUDWindow in $allHUDWindow)
{
#I need to set $currentHUDWindow "Always on top"
Set-WindowActive $currentHUDWindow
Set-WindowPosition -X ($currentPosition.x-10) -Y ($currentPosition.y-30) -WIDTH ($currentPosition.width+20) -HEIGHT ($currentPosition.height+30) -Window $currentHUDWindow
}
}
}
}
}
}
}
Currenlty, 나는 "$ currentHUDWindow-WindowActive 설정"을 호출하지만 나는 또한 기능의이 종류에 적용해야합니다
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
내가 추가 한 시도를 이 함수는 내 코드에 SetForegroundWindow ($ currentHUDWindow)라고 부른다. 하지만 오류가 발생했습니다.
도와 주시겠습니까?
$ currentHUDWindow를 맨 위에 놓아야합니다!
감사
, 당신의 질문에 당신이 가지고있는 오류를하시기 바랍니다 추가 사용하는 방법입니다. –