【问题标题】:How do I maximize Skype from Powershell如何从 Powershell 最大化 Skype
【发布时间】:2023-03-04 18:54:02
【问题描述】:

我正在尝试从 powershell 最大化我的 Skype 窗口。

我使用以下脚本...

$sig = '[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
Add-Type -MemberDefinition $sig -name NativeMethods -namespace Win32
$hwnd = @(Get-Process lync)[0].MainWindowHandle
# Restore window
[Win32.NativeMethods]::ShowWindowAsync($hwnd, 4)

我也试过了

$hwnd = @(Get-Process -id 2560)[0].MainWindowHandle

信息

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14409  1012

但是当我运行命令时它并没有最大化,只是返回 true。我可以从 poershell 最大化 Skype 窗口吗?

【问题讨论】:

    标签: windows powershell windows-7 skype


    【解决方案1】:

    你的问题陈述很接近,但你是using the wrong constant

    $SW_MAXIMIZE = 3
    $sig = @'
    [DllImport("user32.dll")]
    public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    '@
    Add-Type -MemberDefinition $sig -Name Functions -Namespace Win32
    
    $hWnd = (Get-Process -Name lync).MainWindowHandle
    [Win32.Functions]::ShowWindow($hWnd, $SW_MAXIMIZE)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-09
      • 1970-01-01
      • 2014-01-02
      • 1970-01-01
      相关资源
      最近更新 更多