有没有人使用 C# 为 IBM as400 编写示例屏幕抓取工具?
5 回答
使用 interop.AutOIATypeLibrary 和 interop.AutPSTypeLibrary 构建类库时。它抛出如下错误无法将“AutPSTypeLibrary.AutPSClass”类型的 COM 对象转换为接口类型“AutPSTypeLibrary.IAutPS”。此操作失败,因为 IID 为“{891FC4A1-7DD8-11D0-9112-0004AC3617E1}”的接口的 COM 组件上的 QueryInterface 调用因以下错误而失败:不支持此类接口(HRESULT 异常:0x80004002 (E_NOINTERFACE))
我正在使用 VS2017,框架 4.5。互操作 Dll 使用 framework64 中的 regasm.exe 注册,添加了参考
以上 Dlls 工作正常,同时使用控制台应用程序/Win 表单应用程序创建项目。
http://www.codeproject.com/KB/cs/all_ehllapi.aspx
我已经修改了这个例子,它工作得很好。
我每天都在使用这些库。如果您需要任何东西,请随时给我发消息。
例子:
using AutOIATypeLibrary;
using AutPSTypeLibrary;
namespace MyNamespace
{
public class Program
{
public AutPS PS = new AutPS();
public AutOIA OI = new AutOIA();
static void Main()
{
PS.SetConnectionByName("A");
OI.SetConnectionByName("A");
// Gets a string from the presentation space at row 1, col 1, length 5
PS.GetText(1, 1, 5);
// Gets the entire screen as a string. parse as needed.
PS.GetText(1, 1, PS.NumRows * PS.NumCols);
// Searches for a literal string in the presentation space by going forward from your row/col
PS.SearchText("LiteralString".ToUpper(), PsDir.pcSrchForward, 1, 1);
}
}
}
您可能想查看 PHP 中的新功能。最新版本的 PHP 有一个 5250 处理器,允许您创建一个 Web 应用程序,就像它与绿屏交互一样。5250 桥梁信息
我意识到你想要 C#,但我还没有看到任何支持直接与屏幕交互的东西。也许编写一个 PHP 应用程序来连接到 5250 并从那里连接你的 C#。
多年前,我为 Frigidaire 的一个项目用 C 语言编写了一个。内部卡会导致内存泄漏的各种乐趣,但我最终通过在通信卡的边界分配数组找到了解决方案。这是 8 年前的事了,我敢肯定今天的卡要好得多和/或使用本地通信来读取 AS400 屏幕。