1

我对 java 比较陌生,以前从未使用过 JACOB。我正在尝试将此 VBScript 代码转换为 java。我知道 VBScript 更适合使用 COM 自动化,但这是我需要做的:

将此 VBScript 代码转换为工作 java-

Set LPS = CreateObject("atlDirectorObject.atlDirector")
if LPS.CreateTool("3270", 1, True, True, 0, atl3270Tool, ErrMsg) <> 0 Then
  Msgbox "Unable to connect to current 3270 Explorer session."
  wscript.quit
end if

另外,这里是我尝试使用的 CreateTool 函数的描述。

Function CreateTool(ToolName As String, CreateOptions As Long, Visible As Boolean, FocusTool As Boolean, TabHandle As Long, ToolDisp, ErrMsg) As Long
Member of atlDirectorObject.atlDirector

这是我目前在eclipse中编码的。如您所知,我不知道自己在做什么。请帮忙 :'(

import com.jacob.com.*;
import com.jacob.activeX.*;

public class atlDirectorObject {
public ActiveXComponent portal;
public Object portalObj;
public Object atl3270Tool;
public int ErrMsg;

    atlDirectorObject() {
     portal = new ActiveXComponent(atlDirectorObject.atlDirector);
     portalObj = portal.getObject();
}

    public void CreateTool() {
        boolean True;

        if (portalObj.CreateTool("3270",1,True,True,0,atl3270Tool,ErrMsg) !=  0)
         {
             System.out.println("Unable to connect to current 3270 Explorer session.");
         }
    }

    public static void main(String[] args) {
        atlDirectorObject LPS = new atlDirectorObject();
        LPS.CreateTool();
    }

}

4

0 回答 0