简体   繁体   English

将参数传递给已经运行的nsis Java启动器

[英]Pass arguments to already running nsis java launcher

Am using nsis for launching my java application. 我正在使用nsis启动我的Java应用程序。 I wanted to show a window once the application is launched. 启动应用程序后,我想显示一个窗口。 I can pass a command line argument while launching the java application like this. 这样启动Java应用程序时,可以传递命令行参数。

OutFile "Test.exe"
....
ExecWait javaw.exe -jar myapp.jar
SectionEnd

Now I would like to show the default window of the already running java application if another instance of the nsis launcher is invoked. 现在,如果要调用nsis启动器的另一个实例,我想显示已经运行的Java应用程序的默认窗口。 In order to do this I need to pass an argument to my java application. 为了做到这一点,我需要将参数传递给我的java应用程序。 For this to happen I have to pass the argument to the cmd window(internally used by NSIS) of the already running instance. 为此,我必须将参数传递给已经运行的实例的cmd窗口(由NSIS内部使用)。

How would I accomplish this? 我将如何完成?

I'm not sure I understand you correctly but you can use this example to create a mutex for the nsis installer. 我不确定我是否正确理解您,但是您可以使用此示例为nsis安装程序创建互斥体。 The example there will bring to front the already running installer, you can change it a bit to bring to front the running java window, if you know its handle or title. 此处的示例会将已经运行的安装程序显示在前面,如果您知道其句柄或标题,则可以对其进行一些更改以使正在运行的Java窗口显示在前面。

     System::Call "kernel32::CreateMutexA(i 0, i 0, t 'my_mutex') i .r0 ?e"
     Pop $0
     StrCmp $0 0 launch
     FindWindow $1 "my window class" "my window title"
     IntCmp $1 0 bring_front end
     bring_front:
     System::Call "user32::SetForegroundWindow(i r1) i."
     end:
     Abort
     launch:

If you have Spy++ (which comes with Microsoft Visual Studio) you can find the window class of your java app. 如果您有Spy ++(Microsoft Visual Studio随附),则可以找到Java应用程序的窗口类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM