小编saf*_*oli的帖子

我如何在powershell中发送鼠标点击

我如何用这个代码发送鼠标点击这个位置.我希望我的鼠标去那里然后点击.

[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($xposi,$yposi)
Run Code Online (Sandbox Code Playgroud)

谢谢你的回答.

mouse powershell events click

5
推荐指数
2
解决办法
2万
查看次数

如何使用Add-Type通过System.Windows.Forms命名空间添加C#代码?

如何使用命名空间Add-Type添加C#代码System.Windows.Forms?我尝试了以下命令:

Add-Type -TypeDefinition @"
using System;
using System.Windows.Forms;

namespace testnamespace
{
    public static class testclass
    {
        public static string messagebox()
        {
            MessageBox.Show("test")
            return "test";
        }
    }
}
"@ 
Run Code Online (Sandbox Code Playgroud)

但是我遇到了一些错误,例如:

类型或名称空间名称“ Forms”在名称空间“ System.Windows”中不存在(您是否缺少程序集引用?)

我只是想用ONLY在PowerShell中的C#代码。请不要给我的选择。

.net c# powershell powershell-2.0

2
推荐指数
1
解决办法
911
查看次数

如何在PowerShell中使用GetWindowText API函数?

如何在PowerShell中使用GetWindowText API函数?

我试过这样的方式:

    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);
}
"@
Run Code Online (Sandbox Code Playgroud)

我做这样的字符串生成器:

$stringbuilder = New-Object System.Text.StringBuilder
$stringbuilder.Capacity =256
Run Code Online (Sandbox Code Playgroud)

我使用的功能如下:

$WindowTitless = $ImportDll::GetWindowText($TopWindow, $stringbuilder, 256)
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误:

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'."
Run Code Online (Sandbox Code Playgroud)

有人可以帮我使用这个功能吗?如果你能请代码.TNX.

powershell powershell-2.0 powershell-3.0 powershell-4.0

1
推荐指数
1
解决办法
1230
查看次数

什么是多线程程序,它是如何工作的?

什么是多线程程序,它是如何工作的?我读了一些文件,但我很困惑.我知道代码是逐行执行的,但我无法理解程序如何管理它.
一个简单的答案将被赞赏.#例子请(只有动画!)

c# language-agnostic parallel-processing multithreading

-5
推荐指数
2
解决办法
801
查看次数