首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用命令行参数启动Solidworks EDrawingsViewer

使用命令行参数启动Solidworks EDrawingsViewer
EN

Stack Overflow用户
提问于 2012-02-16 23:47:32
回答 1查看 794关注 0票数 0

我有一个简单的类,使用协议处理程序中的edrawingsviewer应用程序打开一个文件。如何在单击“上一步”时强制程序终止?

这就是我所拥有的,我认为它不工作的原因是因为运行时环境是用来启动它的。在通过命令行启动它时,它似乎不会将文件名作为参数,除非进行了运行时环境调用。

如何在不调用rundll32的情况下使用文件名启动edrawingsviewer?

代码语言:javascript
复制
    private void initBackButton() {
        backButton = new JButton("BACK");
        backButton.setPreferredSize(BUTTONSIZE);
        backButton.setMinimumSize(BUTTONSIZE);
        backButton.setSize(BUTTONSIZE);
        backButton.setMaximumSize(BUTTONSIZE);
        backButton.setAlignmentX(0.0F);
        backButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e)  {
                System.out.println("checking for open processes");
                for (Process p : processList) {
                    if (p != null) {
                        p.destroy();
                        System.out.println("killing process");
                    }
                }
                setValue(backButton);
            }
        });
    }

    private void addButtonToPanel(final File file) {
        final JButton button = new JButton();
        button.setPreferredSize(BUTTONSIZE);
        button.setSize(BUTTONSIZE);
        button.setMinimumSize(BUTTONSIZE);
        button.setMaximumSize(BUTTONSIZE);
        button.setFont(FONT);
        button.setText(file.getName().split(jobString)[1]);
        button.setHorizontalTextPosition(SwingConstants.LEFT);
        button.setHorizontalAlignment(SwingConstants.LEFT);
        final List<Process> pl = this.processList;
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    EDrawingDialog.openEDrawingForFileName(file.getName(), button, pl);
                } catch (Exception ex) {
                    System.out.println("addButtonToPane()"+ex);
                }
            }
        });
        buttonPanel.add(button);
    }
       public static void openEDrawingForFileName(String fileName, JButton b, List<Process> processList) {
        try {
            final Process process = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler \\\\xxx.xxx.x.xx\\www\\HMI\\POD EDRAWINGS\\" + fileName);
            processList.add(process);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-24 01:21:11

最终进程进程= Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler“+文件名);

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9314346

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档